date_part() BUG?

From: Roberto Joao Lopes Garcia <roberto(at)mha(dot)com(dot)br>
To: pgsql-bugs(at)postgreSQL(dot)org
Subject: date_part() BUG?
Date: 1999-02-11 14:28:02
Message-ID: 3.0.5.32.19990211122802.008b2490@pop.hipernet.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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(at)mha(dot)com(dot)br
F. 55 11 848 9906 FAX 55 11 848 9955

MHA Engenharia Ltda
E-mail: mha(at)mha(dot)com(dot)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
-------------------------------------------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Rich 1999-02-16 07:42:01 Strange behavior
Previous Message Unprivileged user 1999-02-10 23:22:12 General Bug Report: create table with long tablename with unique index having long fieldname fails