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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: Dennis Gearon <gearond(at)cvc(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...
Date: 2003-02-18 05:17:01
Message-ID: 21092.1045545421@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> 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

Not so --- CURRENT_TIMESTAMP is a function, not a literal, despite the
lack of parentheses (you can blame the SQL spec for that weirdness).
It will in fact *not* work when quoted.

I think you are thinking of now() --- now() is a function, 'now' is
an acceptable timestamp literal, but the latter is generally a bad
choice for a column default because of the time-of-evaluation issue.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2003-02-18 05:29:46 Re: Index not used with IS NULL
Previous Message Dennis Gearon 2003-02-18 05:12:33 Re: TIMESTAMP WITH( OUT)? TIME ZONE indexing/type choice...