Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice... - Mailing list pgsql-general

From Sean Chittenden
Subject Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Date
Msg-id 20030218050502.GF79234@perrin.int.nxad.com
Whole thread Raw
In response to Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...  (Dennis Gearon <gearond@cvc.net>)
Responses Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> create table test_timestamp(
> created timestamp DEFAULT CURRENT_TIMESTAMP::timestamptz NOT NULL
> );

Don't take chances:

CREATE TABLE test (
       created TIMESTAMP WITHOUT TIME ZONE DEFAULT 'CURRENT_TIMESTAMP' NOT NULL
);

iirc, you have to put quotes around CURRENT_TIMESTAMP otherwise the
default value is set to the CURRENT_TIMESTAMP at this very instant
instead of being evaluated at runtime when a record is inserted.  -sc

--
Sean Chittenden

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Next
From: Dennis Gearon
Date:
Subject: Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...