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

Re: BUG #2996: to_char( timestamp, 'DD-Mon-YYYY HH24:MI:SS.MS' ) reports .1000 ms

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Anthony Taylor" <tony(at)tg-embedded(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2996: to_char( timestamp, 'DD-Mon-YYYY HH24:MI:SS.MS' ) reports .1000 ms
Date: 2007-02-14 07:54:10
Message-ID: 19218.1171439650@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
"Anthony Taylor" <tony(at)tg-embedded(dot)com> writes:
> When using the "to_char" function to output timestamps, some timestamps
> report .1000 milliseconds.

Confirmed here: using your test case, successive timestamps look like

 14-Feb-2007 02:44:04.998
 14-Feb-2007 02:44:04.998
 14-Feb-2007 02:44:04.998
 14-Feb-2007 02:44:04.998
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.999
 14-Feb-2007 02:44:04.1000
 14-Feb-2007 02:44:04.1000
 14-Feb-2007 02:44:04.1000
 14-Feb-2007 02:44:05.000
 14-Feb-2007 02:44:05.000
 14-Feb-2007 02:44:05.000
 14-Feb-2007 02:44:05.001
 14-Feb-2007 02:44:05.001
 14-Feb-2007 02:44:05.001
 14-Feb-2007 02:44:05.001
 14-Feb-2007 02:44:05.001

Not having looked at the code, my bet is that this occurs only without
--enable-integer-timestamps; is your installation compiled with that?

It would be interesting to check what happens at an hour or day
boundary; I suspect the roundoff problem may extend to higher units.
We've seen related bugs before :-(

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Magnus HaganderDate: 2007-02-14 11:04:03
Subject: Re: BUG #2993: The program "postgres" is needed by initdb but was not found ...
Previous:From: Tom LaneDate: 2007-02-14 07:39:19
Subject: Re: BUG #3002: PQexecParams only supports some commands; needs improved error reporting, documenting or fixing

pgsql-patches by date

Next:From: Gregory StarkDate: 2007-02-14 13:06:29
Subject: patch to replace VARATT_SIZEP macro
Previous:From: Peter EisentrautDate: 2007-02-14 07:11:12
Subject: Re: [GENERAL] ISO week dates

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