Fred Yankowski <[EMAIL PROTECTED]> writes:
> In PostgreSQL 7.0.3 (on NT), the expression
>       to_char(date '2001-04-01', 'dd')
> evaluates to '31', which is a bit surprising.

It's just a bug: date to timestamp conversion did the wrong thing on
DST forward transition days in 7.0.3 and before.  It's fixed for 7.1.

In EST5EDT time zone, 7.0.* gives:

play=> select timestamp(date '2001-03-31') ;
       timestamp
------------------------
 2001-03-31 00:00:00-05                         -- correct
(1 row)

play=> select timestamp(date '2001-04-01') ;
       timestamp
------------------------
 2001-03-31 23:00:00-05                         -- off by 1 hour
(1 row)

play=> select timestamp(date '2001-04-02') ;
       timestamp
------------------------
 2001-04-02 00:00:00-04                         -- correct
(1 row)

but current sources (7.1beta3) give:

regression=# select timestamp(date '2001-03-31') ;
       timestamp
------------------------
 2001-03-31 00:00:00-05
(1 row)

regression=# select timestamp(date '2001-04-01') ;
       timestamp
------------------------
 2001-04-01 00:00:00-05
(1 row)

regression=# select timestamp(date '2001-04-02') ;
       timestamp
------------------------
 2001-04-02 00:00:00-04
(1 row)


                        regards, tom lane

Reply via email to