Re: Re: round - timestamp bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: garana(at)sinectis(dot)com
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Re: round - timestamp bug
Date: 2001-02-07 15:41:48
Message-ID: 28309.981560508@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Lockhart 2001-02-07 15:57:48 Re: round - timestamp bug
Previous Message Tom Lane 2001-02-07 14:59:35 Re: byteain() doesn't parse correctly