bug in date_part() function in 6.5.2, 7.0.2 - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject bug in date_part() function in 6.5.2, 7.0.2
Date
Msg-id 200009060657.e866vYH14181@hub.org
Whole thread Raw
Responses Re: bug in date_part() function in 6.5.2, 7.0.2  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-bugs
Alex Karpov (analyst@sibinet.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

pgsql-bugs by date:

Previous
From: "Alexei E Korneyev"
Date:
Subject: Re: Possible bug in referential integrity system
Next
From: Karel Zak
Date:
Subject: Re: bug in date_part() function in 6.5.2, 7.0.2