Unix Technical Forum

CURRENT_TIMESTAMP wierd behaviour

This is a discussion on CURRENT_TIMESTAMP wierd behaviour within the Pgsql General forums, part of the PostgreSQL category; --> Hi all I have created the following simple table create table NTE_NOTES ( nte_id int unique not null, nte_text ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 10:58 AM
Andy Foster
 
Posts: n/a
Default CURRENT_TIMESTAMP wierd behaviour

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


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 10:58 AM
Scott Marlowe
 
Posts: n/a
Default Re: CURRENT_TIMESTAMP wierd behaviour

On Thu, 2006-08-10 at 09:37, Andy Foster wrote:
> 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?


Read here:

http://www.postgresql.org/docs/8.1/i...TETIME-CURRENT


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com