Skip site navigation (1) Skip section navigation (2)

Re: BUG #3607: timestamp is behaving strangely

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Cade Cairns" <cadec(at)otii(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3607: timestamp is behaving strangely
Date: 2007-09-07 20:53:26
Message-ID: 21900.1189198406@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Cade Cairns" <cadec(at)otii(dot)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

In response to

pgsql-bugs by date

Next:From: LIZETH ANGHELA SIRPA CACERESDate: 2007-09-09 00:38:00
Subject: HELP URGENTE
Previous:From: Tom LaneDate: 2007-09-07 20:04:17
Subject: Re: BUG #3606: Query Plan Failure or Index Corruption?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group