Re: 6.5.0 datetime bug? - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: 6.5.0 datetime bug?
Date
Msg-id 38E4C640.3B4907F0@alumni.caltech.edu
Whole thread Raw
In response to Re: 6.5.0 datetime bug?  (gravity@dds.nl)
List pgsql-hackers
> > Hmm, I happen to have a 6.5.0 system sitting here: It works there, so I suspect
> > something with your local operating system config.
> anyone?

It turns out to be a problem in the local country config :)

Why does the Netherlands (or at least my RH5.2 timezone database)
think you switch to DST on March 26? The date_part() function was just
masking the problem:

postgres=# select '3-27-2000'::timestamp-'3-6-2000'::timestamp;?column? 
----------20 23:00
(1 row)

postgres=# select '3-26-2000'::timestamp-'3-6-2000'::timestamp;?column? 
----------20 00:00
(1 row)

When you do the date arithmetic, you are automatically calculating an
*absolute* time difference which can be affected by DST boundaries.

For some reason, we don't have a date_part() available for the date
data type, which would have been my suggested workaround. We'd flame
the implementer, but that's me so I'll be nice :(

It is probably too late to get this added for v7.0, though I might be
able to add the code to the backend so it could be a (very) small
CREATE FUNCTION operation to get it usable for 7.0. Will look at it.
                        - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: 6.5.0 datetime bug?
Next
From: Karel Zak
Date:
Subject: procedure returns a tuple