bug in date_part() function in 6.5.2, 7.0.2

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: bug in date_part() function in 6.5.2, 7.0.2
Date: 2000-09-06 06:57:34
Message-ID: 200009060657.e866vYH14181@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alex Karpov (analyst(at)sibinet(dot)ru) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
bug in date_part() function in 6.5.2, 7.0.2

Long Description
Checked on Postgres version 6.5.2 and 7.0.2:
Incorrect DOW and DAY parts of date calculation. See exanple code.
I`ve not tested this function for another time interval, only for march 2000.

?column? | date_part | date_part
------------+-----------+-----------
24.03.2000 | 24 | 5
25.03.2000 | 25 | 6
26.03.2000 | 25 | 6
27.03.2000 | 27 | 1
(4 rows)

Sample Code
create table oops (date date);

insert into oops (date) values (to_date('24.03.2000','dd.mm.yyyy'));
insert into oops (date) values (to_date('25.03.2000','dd.mm.yyyy'));
insert into oops (date) values (to_date('26.03.2000','dd.mm.yyyy'));
insert into oops (date) values (to_date('27.03.2000','dd.mm.yyyy'));

select
date::date
,date_part('day',date::date)
,date_part('dow',date::date)
from oops
order by date;

?column? | date_part | date_part
------------+-----------+-----------
24.03.2000 | 24 | 5
25.03.2000 | 25 | 6
26.03.2000 | 25 | 6
27.03.2000 | 27 | 1
(4 rows)

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Karel Zak 2000-09-06 07:21:09 Re: bug in date_part() function in 6.5.2, 7.0.2
Previous Message Alexei E Korneyev 2000-09-06 05:42:59 Re: Possible bug in referential integrity system