Re: Re: Date of creation and of change

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Tille <tillea(at)rki(dot)de>
Cc: hlefebvre <hlefebvre(at)lexbase(dot)net>, PostgreSQL SQL <pgsql-sql(at)hub(dot)org>
Subject: Re: Re: Date of creation and of change
Date: 2000-08-23 14:35:58
Message-ID: 28092.967041358@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andreas Tille <tillea(at)rki(dot)de> writes:
> On Wed, 23 Aug 2000, hlefebvre wrote:
>> create table mytable( CreateDate timestamp default timestamp('now'),
>> ....);
> I've done a pg_dump <mydb> and there this line was transformed to:

> "createdat" timestamp DEFAULT '23.08.2000 15:35:16.00 CEST'::"timestamp",

This approach does not work in 7.0 (I think it did work in some prior
releases, but not recently). The recommended method is shown in the
FAQ:

4.22) How do I create a column that will default to the current time?

Use now():
CREATE TABLE test (x int, modtime timestamp default now() );

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Adam Lang 2000-08-23 14:38:00 Copy To - fixed width
Previous Message hlefebvre 2000-08-23 14:35:49 Re: Re: Date of creation and of change