Re: Timestamp Default value - Mailing list pgsql-novice

From Tom Lane
Subject Re: Timestamp Default value
Date
Msg-id 14400.1082574208@sss.pgh.pa.us
Whole thread Raw
In response to Timestamp Default value  ("Christopher A. Goodfellow" <cgoodfellow@tealuxe.com>)
List pgsql-novice
"Christopher A. Goodfellow" <cgoodfellow@tealuxe.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

pgsql-novice by date:

Previous
From: Michael Guerin
Date:
Subject: Re: vacuum full question.
Next
From: Tom Lane
Date:
Subject: Re: vacuum full question.