Wrong manual info?

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: <pgsql-docs(at)postgresql(dot)org>
Subject: Wrong manual info?
Date: 2001-10-08 08:03:06
Message-ID: ECEHIKNFIMMECLEBJFIGKECJCCAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

>From the 7.2 manual, functions-datetime.html:

All the date/time datatypes also accept the special literal value now to
specify the current date and time. Thus, the following three all return the
same result:

SELECT CURRENT_TIMESTAMP;
SELECT now();
SELECT TIMESTAMP 'now';

Note: You do not want to use the third form when specifying a DEFAULT value
while creating a table. The system will convert now to a timestamp as soon
as the constant is parsed, so that when the default value is needed, the
time of the table creation would be used! The first two forms will not be
evaluated until the default value is used, because they are function calls.
Thus they will give the desired behavior of defaulting to the time of row
insertion.

As far as I can tell, 'now' works perfectly as a dynamic column DEFAULT. It
uses insert time, NOT table creation time

Chris

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2001-10-08 14:50:53 Re: Wrong manual info?
Previous Message Norman Megill 2001-10-08 03:08:09 FOR i IN REVERSE documentation error?