Re: Re: round - timestamp bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Re: round - timestamp bug
Date
Msg-id 28309.981560508@sss.pgh.pa.us
Whole thread Raw
In response to Re: round - timestamp bug  (William Boyle <woboyle@ieee.org>)
List pgsql-bugs
> Gonzalo Arana wrote:
>> radius=# create table x (x timestamp);
>> CREATE
>> radius=# insert into x (x) values ('Tue 23 Jan 21:38:59.997 2001');
>> INSERT 619178 1
>> radius=# select * from x;
>> x
>> ---------------------------------
>> Tue 23 Jan 21:38:60.00 2001 ART
>> (1 row)

This is just a display artifact.  The value stored is actually ... 59.997
(plus or minus a little bit from floating-point roundoff error) but the
seconds value is rounded to two digits during display.

I have suggested in the past that it'd be better to round the floating
value to two fractional digits before we break it down to date/hh/mm/ss,
rather than after, but that suggestion seems to have fallen on deaf
ears.

            regards, tom lane

pgsql-bugs by date:

Previous
From: William Boyle
Date:
Subject: Re: round - timestamp bug
Next
From: Thomas Lockhart
Date:
Subject: Re: round - timestamp bug