Lists: | pgsql-hackers |
---|
From: | Roberto Joao Lopes Garcia <roberto(at)mha(dot)com(dot)br> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | date_part() BUG? |
Date: | 1999-02-11 16:26:12 |
Message-ID: | 3.0.5.32.19990211142612.008b8980@pop.hipernet.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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(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
-------------------------------------------------------------------
From: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Roberto Joao Lopes Garcia <roberto(at)mha(dot)com(dot)br> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] date_part() BUG? |
Date: | 1999-02-11 17:08:59 |
Message-ID: | 36C30EAB.E0257FD6@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | 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:
<snip tests for years through seconds>
> But
> 1 for 'decade' NOT OK!
> 1 for 'century' NOT OK!
> 1 for 'millenium' NOT OK!
I can see that here. Will look at it. Thanks for the report...
- Tom
From: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Roberto Joao Lopes Garcia <roberto(at)mha(dot)com(dot)br>, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] date_part() BUG? |
Date: | 1999-02-11 17:38:12 |
Message-ID: | 36C31584.984BC08B@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> > using age() function I get: @ 1 hour 13 mins 27.88 secs
> > using date_part() over age() I get:
> <snip tests for years through seconds>
> > But
> > 1 for 'decade' NOT OK!
> > 1 for 'century' NOT OK!
> > 1 for 'millenium' NOT OK!
> I can see that here. Will look at it. Thanks for the report...
Sorry, it was a cut-and-paste error, with an explicit "+ 1" where it
shouldn't be. Patch enclosed, which includes another recent fix for date
input having mixed US/Euro-style formats and text months. If you've
already applied that one, then strip it out of the patch before applying
(or tell patch the right thing when it complains).
Thanks again for the report.
- Tom
Attachment | Content-Type | Size |
---|---|---|
dt.c.patch | text/plain | 6.2 KB |