Re: Default Timestamp 'Now' bug with 7.4 on Panther.

Lists: pgsql-bugs
From: Harry Hochheiser <hsh(at)nih(dot)gov>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Harry Hochheiser <hsh(at)nih(dot)gov>, siah(at)nih(dot)gov
Subject: Default Timestamp 'Now' bug with 7.4 on Panther.
Date: 2004-02-12 20:21:34
Message-ID: 0D406079-5D99-11D8-BDC7-0003938AD324@nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


Running Postgres 7.4 on Panther, there seems to be a problem with
setting a timestamp column to have a default of 'now':

createdb test

create table bar (date timestamp DEFAULT 'now');
insert into bar DEFAULT VALUES;
insert into bar DEFAULT VALUES;
insert into bar DEFAULT VALUES;
insert into bar DEFAULT VALUES;

select * from BAR;

output:

date
----------------------------
2004-02-12 15:17:38.838411
2004-02-12 15:17:38.838411
2004-02-12 15:17:38.838411
2004-02-12 15:17:38.838411

All rows have the same timestamp, as if 'now' was interpreted at the
time of table creation, not at the time of insertion.

thanks,

Harry

Harry Hochheiser, Ph.D.
Image Informatics and Computational Biology Unit
Laboratory of Genetics
NIH, National Institute on Aging
333 Cassell Drive
Suite 3000
Baltimore MD 21224
410 558 8046


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Harry Hochheiser <hsh(at)nih(dot)gov>
Cc: pgsql-bugs(at)postgresql(dot)org, siah(at)nih(dot)gov
Subject: Re: Default Timestamp 'Now' bug with 7.4 on Panther.
Date: 2004-02-15 18:31:32
Message-ID: 9438.1076869892@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Harry Hochheiser <hsh(at)nih(dot)gov> writes:
> Running Postgres 7.4 on Panther, there seems to be a problem with
> setting a timestamp column to have a default of 'now':

There was an intentional change of behavior --- see the release notes.
The supported way to do this is to use CURRENT_TIMESTAMP or now() as
the column default.

regards, tom lane


From: Harry Hochheiser <hsh(at)nih(dot)gov>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, siah(at)nih(dot)gov
Subject: Re: Default Timestamp 'Now' bug with 7.4 on Panther.
Date: 2004-02-16 15:38:01
Message-ID: 1A91AEA0-6096-11D8-BF7C-0003938AD324@nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


Ok, thanks. that's what i get for using a premade package, I guess.

-harry

On Feb 15, 2004, at 1:31 PM, Tom Lane wrote:

> Harry Hochheiser <hsh(at)nih(dot)gov> writes:
>> Running Postgres 7.4 on Panther, there seems to be a problem with
>> setting a timestamp column to have a default of 'now':
>
> There was an intentional change of behavior --- see the release notes.
> The supported way to do this is to use CURRENT_TIMESTAMP or now() as
> the column default.
>
> regards, tom lane
>