Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOETK-0003VX-Qi for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 03:41:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOETJ-0002kx-GG for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 03:41:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOETJ-0002kn-4j for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 03:41:53 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOETF-0001AY-RW for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 03:41:51 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id E337E410B2; Thu, 31 May 2018 05:41:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id f4okptHPOISt; Thu, 31 May 2018 05:41:44 +0200 (CEST) Message-ID: <1527738102.2400.1.camel@cybertec.at> Subject: Re: Insert UUID GEN 4 Value From: Laurenz Albe To: tango ward , "pgsql-generallists.postgresql.org" Date: Thu, 31 May 2018 05:41:42 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk tango ward wrote: > I would like to know how to properly use uuid_generate_v4 when inserting data into PostgreSQL table. > > When I run the command select * from pg_available_extensions; > I can see this uuid-ossp | 1.0 | | generate universally unique identifiers (UUIDs) > > I am trying to find a basic and easy to understand documentation of it on how to use > when inserting data because I have a column that is a uuid type. Are you looking for this? ALTER TABLE tab ALTER col SET DEFAULT uuid_generate_v1(); Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com