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