Unix Technical Forum

BUG #3607: timestamp is behaving strangely

This is a discussion on BUG #3607: timestamp is behaving strangely within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 3607 Logged by: Cade Cairns Email address: cadec@otii.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 12:06 PM
Cade Cairns
 
Posts: n/a
Default BUG #3607: timestamp is behaving strangely


The following bug has been logged online:

Bug reference: 3607
Logged by: Cade Cairns
Email address: cadec@otii.com
PostgreSQL version: 8.1.9
Operating system: Mac OS X 10.4.10
Description: timestamp is behaving strangely
Details:

test=> select '2007-05-11 09:33:01.167885'::timestamp without time zone,
('epoch'::timestamp without time zone + '1178875981.167885
seconds'::interval)::timestamp without time zone;
timestamp | timestamp
----------------------------+----------------------------
2007-05-11 09:33:01.167885 | 2007-05-11 09:33:01.167885
(1 row)

test=> select '2007-05-11 09:33:01.167885'::timestamp without time zone =
('epoch'::timestamp without time zone + '1178875981.167885
seconds'::interval)::timestamp without time zone;
?column?
----------
f
(1 row)

Why?

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 12:06 PM
Tom Lane
 
Posts: n/a
Default Re: BUG #3607: timestamp is behaving strangely

"Cade Cairns" <cadec@otii.com> writes:
> test=> select '2007-05-11 09:33:01.167885'::timestamp without time zone,
> ('epoch'::timestamp without time zone + '1178875981.167885
> seconds'::interval)::timestamp without time zone;
> timestamp | timestamp
> ----------------------------+----------------------------
> 2007-05-11 09:33:01.167885 | 2007-05-11 09:33:01.167885
> (1 row)


> test=> select '2007-05-11 09:33:01.167885'::timestamp without time zone =
> ('epoch'::timestamp without time zone + '1178875981.167885
> seconds'::interval)::timestamp without time zone;
> ?column?
> ----------
> f
> (1 row)


If you're using floating-point timestamps (which is the default build)
you are up against the limit of accuracy of a standard float8 value.
IOW that's not really exactly 09:33:01.167885, but close to it.
Checking this example shows that the two float timestamps internally
are 232191181.16788501 and 232191181.16788507.

regards, tom lane

---------------------------(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
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 02:00 PM.


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