date_part() BUG?
От | Roberto Joao Lopes Garcia |
---|---|
Тема | date_part() BUG? |
Дата | |
Msg-id | 3.0.5.32.19990211142612.008b8980@pop.hipernet.com.br обсуждение исходный текст |
Список | pgsql-hackers |
I´m making tests for data types and I wonder if the following is a bug! using age() function I get: @ 1 hour 13 mins 27.88 secs using date_part() over age() I get: 1 for 'hour' OK! 13 for 'minute' OK! 27.8765430000003 for 'second' OK! 0 for 'day' OK! 0 for 'month' OK! 0 for 'year' OK! But 1 for 'decade' NOT OK! 1 for 'century' NOT OK! 1 for 'millenium' NOT OK! See trancrition bellow cd=> \d th Table = th +----------------------------------+----------------------------------+-- -----+ | Field | Type| Length| +----------------------------------+-------------------------------- --+-------+ | data | date | 4 | | hora | time | 8 | | ms | int4 | 4 | | dt | datetime | 8 | +----------------------------------+----------------------------------+--- ----+ cd=> select * from th cd-> \g data |hora | ms|dt ----------+--------+----------+-------------------------- 11/02/1999|10:33: 31|1234567890|11/02/1999 10:33:31.12 EDT 11/02/1999|10:33:31|1234567890|11/02/1999 10:33:31.13 EDT (2 rows) cd=> select age('now', dt) , date_part('millenium', age('now', dt)::timespan), date_part('century', age('now', dt)::timespan), date_part('decade', age('now', dt)::timespan) , date_part('year', age('now', dt)::timespan), date_part('month', age('now', dt)::timespan), date_part('day', age('now', dt)::timespan) , date_part('hour', age('now', dt)::timespan) , date_part('minute', age('now', dt)::timespan) , date_part('second', age('now', dt)::timespan) from th\g age |date_part|date_part|date_part|date_part|date_part|date_part|date_part|date_ part| date_part ---------------------------+---------+---------+---------+-------- -+---------+---------+---------+---------+---------------- @ 1 hour 13 mins 27.88 secs| 1| 1| 1| 0| 0| 0| 1| 13|27.8765430000003 @ 1 hour 13 mins 27.87 secs| 1| 1| 1| 0| 0| 0| 1| 13|27.8654319999996 (2 rows) cd=> ------------------------------------------------------------------ Eng. Roberto João Lopes Garcia E-mail: roberto@mha.com.br F. 55 11 848 9906 FAX 55 11 848 9955 MHA Engenharia Ltda E-mail: mha@mha.com.br WWW: http://www.mha.com.br Av Maria Coelho Aguiar, 215 Bloco D 2 Andar Centro Empresarial de Sao Paulo Sao Paulo - BRASIL - 05805 000 -------------------------------------------------------------------
В списке pgsql-hackers по дате отправления: