dbTalk Databases Forums  

[BUGS] timestamp arithmetic

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] timestamp arithmetic in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ed L.
 
Posts: n/a

Default [BUGS] timestamp arithmetic - 12-16-2004 , 07:19 PM






Note the queries below generate the same result regardless of the timezone input:

% env | grep TZ
PGTZ=CST6CDT
TZ=CST6CDT

% psql -t -c "select version()"
PostgreSQL 8.0.0beta3 on i686-pc-linux-gnu, compiled by GCC 2.96

% psql -t -c "select '1970-01-01 00:00:00+09'::timestamp + '1089352800 seconds'::interval"
2004-07-09 06:00:00

% psql -t -c "select '1970-01-01 00:00:00+03'::timestamp + '1089352800 seconds'::interval"
2004-07-09 06:00:00

% psql -t -c "select '1970-01-01 00:00:00+01'::timestamp + '1089352800 seconds'::interval"
2004-07-09 06:00:00

Ed


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

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] timestamp arithmetic - 12-16-2004 , 07:26 PM






"Ed L." <pgsql (AT) bluepolka (DOT) net> writes:
Quote:
Note the queries below generate the same result regardless of the timezone input:
This isn't a bug. Per documentation:

: For timestamp [without time zone], any explicit time zone specified in
: the input is silently ignored. That is, the resulting date/time value is
: derived from the explicit date/time fields in the input value, and is
: not adjusted for time zone.

You want to use timestamp with time zone (timestamptz), I think.

regards, tom lane

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

http://www.postgresql.org/docs/faqs/FAQ.html


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.