Re: Conversion errors for datetime fields
От | Tom Lane |
---|---|
Тема | Re: Conversion errors for datetime fields |
Дата | |
Msg-id | 5421.978020894@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Conversion errors for datetime fields (pgsql-bugs@postgresql.org) |
Ответы |
Re: Conversion errors for datetime fields
|
Список | pgsql-bugs |
pgsql-bugs@postgresql.org 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
В списке pgsql-bugs по дате отправления: