Re: bug in date_part() function in 6.5.2, 7.0.2

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: bug in date_part() function in 6.5.2, 7.0.2
Дата
Msg-id 39B730AF.BBEC447E@alumni.caltech.edu
обсуждение исходный текст
Ответ на Re: bug in date_part() function in 6.5.2, 7.0.2  (Karel Zak <zakkr@zf.jcu.cz>)
Ответы Re: bug in date_part() function in 6.5.2, 7.0.2  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
> >  ....it's not date_part() bug, it's to_date() bug:
> Looks to me like an off-by-one kind of problem in deciding which
> timezone applies to midnight of a transition day.

Probably a bit worse (but no problem to solve ;): you need to make sure
that you rotate the date type to the correct time zone when you do the
conversion to timestamp. If you just blast the yy/mm/dd into the time
structure, leaving the time zone fields zero'd out, then you will be
doing the conversion in UTC. When the timestamp is read back out it is
converted to your local time zone.

The date->timestamp conversion code gets this right, so you might want
to look at that. From my testing, the only annoying case is for 02:00 on
the day of a DST transition, when you either skip or get an extra hour.

If you still have trouble, I'd be happy to look at your code...

                    - Thomas

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Possible bug in referential integrity system
Следующее
От: Tom Lane
Дата:
Сообщение: Re: bug in date_part() function in 6.5.2, 7.0.2