Обсуждение: BUG #4757: to_timestamp returns incorrect result

Поиск
Список
Период
Сортировка

BUG #4757: to_timestamp returns incorrect result

От
"Timofey.Asyrkin"
Дата:
The following bug has been logged online:

Bug reference:      4757
Logged by:          Timofey.Asyrkin
Email address:      timoha-tim@ngs.ru
PostgreSQL version: 8.3
Operating system:   Ubuntu 8.10
Description:        to_timestamp returns incorrect result
Details:

Hello everybody,

It looks like there is a bug in to_timestamp function:
I'm living in Italy and I have a timezone GMT+2 (summer).
These two queries return the same result:

1)select TO_TIMESTAMP( '25/03/2001 02:00:00', 'dd/mm/yyyy hh24:mi:ss' );
2)select TO_TIMESTAMP( '25/03/2001 03:00:00', 'dd/mm/yyyy hh24:mi:ss' );

Result: 2001-03-25 03:00:00+02

Having executed with different date, but the same time didn't gave such
result, moreover, changing the timezone gives correct result.

Kind regards,
Timofey

Re: BUG #4757: to_timestamp returns incorrect result

От
Tom Lane
Дата:
"Timofey.Asyrkin" <timoha-tim@ngs.ru> writes:
> I'm living in Italy and I have a timezone GMT+2 (summer).
> These two queries return the same result:

> 1)select TO_TIMESTAMP( '25/03/2001 02:00:00', 'dd/mm/yyyy hh24:mi:ss' );
> 2)select TO_TIMESTAMP( '25/03/2001 03:00:00', 'dd/mm/yyyy hh24:mi:ss' );

> Result: 2001-03-25 03:00:00+02

If that day is a DST transition day, those results are not wrong.
The two times are the same, and it happens that we preferentially
show that time in DST.

            regards, tom lane