CURRENT_TIMESTAMP wierd behaviour

From: "Andy Foster" <andy(at)fostersontheweb(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: CURRENT_TIMESTAMP wierd behaviour
Date: 2006-08-10 14:37:10
Message-ID: 20060810143735.A34F75AF03C@svr4.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all

I have created the following simple table

create table NTE_NOTES (
nte_id int unique not null,
nte_text text not null,
nte_last_updated timestamp not null,
constraint nte_pk primary key (nte_id));

If I execute the following sql as a single transaction in the admin
interface or using JDBC it appears that the CURRENT_TIMESTAMP has the same
value for all records including the updated one. Why?

insert into NTE_NOTES (nte_id, nte_text, nte_last_updated)
values(99999,'demo study note text',CURRENT_TIMESTAMP);
insert into NTE_NOTES (nte_id, nte_text, nte_last_updated)
values(29999,'demo study note text',CURRENT_TIMESTAMP);
insert into NTE_NOTES (nte_id, nte_text, nte_last_updated)
values(39999,'demo study note text',CURRENT_TIMESTAMP);
update NTE_NOTES set nte_last_updated = CURRENT_TIMESTAMP where nte_id =
99999;
select * from NTE_NOTES;

Results from call:

29999;"demo study note text";"2006-08-10 15:34:51.593"
39999;"demo study note text";"2006-08-10 15:34:51.593"
99999;"demo study note text";"2006-08-10 15:34:51.593"

Now I am not a db expert so unless this is something to do with the
transaction I would have expected different date values.

Can anyone give me an insight?

Regards

Andy Foster

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Laudeman 2006-08-10 15:00:00 Re: Tuning to speed select
Previous Message Merlin Moncure 2006-08-10 14:26:11 Re: Tuning to speed select