Re: datetime error? - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: datetime error?
Date
Msg-id 3C347F27.722AEDDD@fourpalms.org
Whole thread Raw
In response to datetime error?  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: datetime error?  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-hackers
> > >  I start fix my bug with "YY vs. zero" in formatting.c, and before it
> > >  a see current CVS:
...
> > Hmm, is 2001-10-10 a daylight-savings transition day in your timezone?
>  No, it's daylight-savings independent. The interesting thing is that
>  you not see it. I found some things:
> 
>  * it not happen for GMT timezone, but for others only (I test 'Japan'
>    and 'CET').
> 
>  * the difference between to_date and to_timestamp is that to_date use
>    the timestamp_date() for conversion. And in the timestamp_date() is
>    used timestamp2tm() that output bad 'tm' struct.
> 
>    The basic difference is that timestamp2tm() with right output do
>    code that call localtime() and timestamp2tm() with bad output skip
>    it, because 'tzp' is not defined ("if (tzp != NULL)" in this
>    timestamp2tm()).

Ah! Have you tried calling timestamptz_date() instead? That one allows
handling time zones internally. Before 7.2, timestamp_date() did handle
time zones, but now we have TIMESTAMP WITHOUT TIME ZONE and TIMESTAMP
WITH TIME ZONE so those internal routines changed out from under you.
                        - Thomas


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PGSQL - FAQ 4.1
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] Bug #549: select table privilege in postgres allows user to create index on the table