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 1fOEd4-00045i-R9 for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 03:51:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOEd3-0008Ai-8P for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 03:51:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOEd3-0008AZ-0j for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 03:51:57 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOEd0-00021g-2e for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 03:51:56 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (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 B9FDE40FE8; Thu, 31 May 2018 05:51:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id h9-9kEB0DfgJ; Thu, 31 May 2018 05:51:51 +0200 (CEST) Message-ID: <1527738710.2400.4.camel@cybertec.at> Subject: Re: Insert UUID GEN 4 Value From: Laurenz Albe To: tango ward Cc: "pgsql-generallists.postgresql.org" Date: Thu, 31 May 2018 05:51:50 +0200 In-Reply-To: References: <1527738102.2400.1.camel@cybertec.at> 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 found this: > > CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; > SELECT uuid_generate_v4(); > > My problem is I have a table like this: > CREATE TABLE enrollmentinfo ( > id integer NOT NULL, > created timestamp with time zone NOT NULL, > modified timestamp with time zone NOT NULL, > secure_id uuid NOT NULL, > relationship character varying(50) NOT NULL, > tuition_bill character varying(255) NOT NULL > ); > > Now I need to insert data into this table, I just don't know if I can use something like this > "INSERT INTO enrollmentinfo (current_timestamp, current_timestamp, uuid_generate_v4(), '', ''); > I haven't tried this but also not sure if I can call the function inside INSERT. Why didn't you try it? I see no problem with that. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com