[EMAIL PROTECTED] writes:
> select '0:00:59.99999999999999'::time as fourteen_dec,
>        '0:00:59.999999999999999'::time as fifteen_dec;

> -- Output from psql
> -- fourteen_dec | fifteen_dec 
> ----------------+-------------
> -- 00:00:59     | 00:00:00
> --(1 row)

What I'm getting with current sources is

regression=# select '0:00:59.99999999999999'::time as fourteen_dec;
 fourteen_dec
--------------
 00:00:59
(1 row)

which seems to be rounding in the wrong direction, and

regression=# select '0:00:59.999999999999999'::time as fifteen_dec;
ERROR:  Bad time external representation '0:00:59.999999999999999'

That one seems reasonable, since this input is indistinguishable from

regression=# select '0:00:60'::time;
ERROR:  Bad time external representation '0:00:60'

However, I also get

regression=# select now()::date+'0:00:59.999'::time;
         ?column?
---------------------------
 2000-12-28 00:00:60.00-05
(1 row)

The cause is clear enough: the 59.999 seconds are being rounded off
to two digits for display.  But it's unfortunate that this causes a
displayed output that will not be accepted as valid input.  Perhaps
it would be a good idea to round off the seconds to display precision
*before* the value is broken down to hh/mm/ss.

                        regards, tom lane

Reply via email to