Re: Timestamp Default value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cgoodfellow(at)tealuxe(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Timestamp Default value
Date: 2004-04-21 19:03:28
Message-ID: 14400.1082574208@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Christopher A. Goodfellow" <cgoodfellow(at)tealuxe(dot)com> writes:
> I created a table with column named orderdate and a default of Now() by the
> following command:

> CREATE TABLE "trans_test" (
> "orderdate" timestamp without time zone DEFAULT timestamp 'now ( )' NOT
> NULL,

That should just be
... DEFAULT now() ...
or if you want to be SQL spec compliant
... DEFAULT LOCALTIMESTAMP ...

What you have is a timestamp literal that is parsed at the instant of
table creation. The parentheses are perhaps misleading you into
thinking that you have written a function call, but you haven't ---
the timestamp input converter is just ignoring them.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-04-21 19:14:12 Re: vacuum full question.
Previous Message Michael Guerin 2004-04-21 17:50:13 Re: vacuum full question.