dbTalk Databases Forums  

[BUGS] extract epoch bug

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


Discuss [BUGS] extract epoch bug in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hans Olav Eggestad
 
Posts: n/a

Default [BUGS] extract epoch bug - 07-05-2005 , 09:03 AM






I've just installed v8.0.3 and tested the 'epoch' part of extract, which for
my applications is fundamental. here is the result:

jova=# select extract(epoch from timestamp '19700102')\g
date_part
-----------
82800
(1 row)

jova=# select extract(epoch from timestamp '19700101')\g
date_part
-----------
-3600
(1 row)

jova=# select extract(epoch from timestamp with time zone '19700101')\g
date_part
-----------
-3600
(1 row)

jova=# select extract(epoch from timestamp without time zone '19700101')\g
date_part
-----------
-3600
(1 row)

the time zone here is 1 hour before GMT, so i guess it has something to do with that, but i have to have this function correct. hope i can get a patch for this soon. (BTW i've not tested this in earlier versions, but i'm now going to make posgres version of my sybase applications)

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)

Reply With Quote
  #2  
Old   
Achilleus Mantzios
 
Posts: n/a

Default Re: [BUGS] extract epoch bug - 07-05-2005 , 09:44 AM






O Hans Olav Eggestad έγραψε στις Jul 5, 2005 :

Quote:
I've just installed v8.0.3 and tested the 'epoch' part of extract, which for
my applications is fundamental. here is the result:

jova=# select extract(epoch from timestamp '19700102')\g
date_part
-----------
82800
(1 row)

jova=# select extract(epoch from timestamp '19700101')\g
date_part
-----------
-3600
(1 row)

jova=# select extract(epoch from timestamp with time zone '19700101')\g
date_part
-----------
-3600
(1 row)

jova=# select extract(epoch from timestamp without time zone '19700101')\g
date_part
-----------
-3600
(1 row)
I get pretty much of the same (with the respective 2 hours difference)
for EST TZ, on pgsql 7.4.6.

If you do

dynacom=# SET TimeZone TO UTC;
dynacom=# select extract(epoch from timestamp without time zone
'1970-01-01 00:00:00.000');
date_part
-----------
0
(1 row)

dynacom=# select extract(epoch from timestamp without time zone
'1970-01-01 00:00:04.000');
date_part
-----------
4
(1 row)

dynacom=#
dynacom=# select extract(epoch from timestamp without time zone
'1970-01-01 01:00:00.000');
date_part
-----------
3600
(1 row)

dynacom=# select extract(epoch from timestamp without time zone
'1970-01-02 00:00:00.000');
date_part
-----------
86400
(1 row)


Notice that:

dynacom=# select extract(epoch from timestamp with time zone '1970-01-01
00:00:00.000+0');
date_part
-----------
0
That might do the trick for you, altho with a first glance
i think that this should behave the same way as
the without time zone version, but it doesnt.


Quote:
the time zone here is 1 hour before GMT, so i guess it has something to do with that, but i have to have this function correct. hope i can get a patch for this soon. (BTW i've not tested this in earlier versions, but i'm now going to make posgres version of my sybase applications)

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)

--
-Achilleus


---------------------------(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
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] extract epoch bug - 07-05-2005 , 10:05 AM



olav (AT) venus (DOT) jordforsk.no (Hans Olav Eggestad) writes:
Quote:
I've just installed v8.0.3 and tested the 'epoch' part of extract, which for
my applications is fundamental. here is the result:
[ snip ]
Nothing wrong with that that I can see. If you want a date to be
interpreted as midnight GMT rather than midnight your local zone,
either say so or set TimeZone to GMT.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


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.