Обсуждение: BUG in date_part
Hello,
I've discovered a bug in the date_part function. It returns 25 when
doing select date_part('day','2000-03-26'::date);
Anyway, this isn't happening if casting the date to timestamp
select date_part('day','2000-03-26'::timestamp);
Alexander
[ Charset ISO-8859-1 unsupported, converting... ]
> Hello,
> I've discovered a bug in the date_part function. It returns 25 when
> doing select date_part('day','2000-03-26'::date);
> Anyway, this isn't happening if casting the date to timestamp
> select date_part('day','2000-03-26'::timestamp);
It is fixed in current sources:
test=> select date_part('day','2000-03-26'::date);
date_part
-----------
26
(1 row)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
"Alexandru COSTIN" <acostin@NOSPAMrds.ro> writes:
> I've discovered a bug in the date_part function. It returns 25 when
> doing select date_part('day','2000-03-26'::date);
Is 2000-03-26 a daylight savings changeover day where you live?
If so, this is a known bug that's fixed for 7.1. date_part is not
the problem, it's being handed a wrong timestamp input value ---
there's a DST boundary bug in the date-to-timestamp converter.
In my timezone 2000-04-02 was a changeover day, and 7.0.2 gives:
select '2000-04-02'::date::timestamp;
?column?
------------------------
2000-04-01 23:00:00-05
(1 row)
regards, tom lane