Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Date: 2003-02-18 05:05:02
Message-ID: 20030218050502.GF79234@perrin.int.nxad.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-02-18 05:12:33 Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Previous Message Tom Lane 2003-02-18 05:04:21 Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...