date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)
Date: 2001-05-01 00:51:58
Message-ID: 1157.988678318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
>> Thomas, what do you think of the persistent reports of date conversion
>> problems at DST boundaries, eg, Ayal Leibowitz's report today in
>> pgsql-bugs? I cannot reproduce any such problem --- and my local
>> timezone database claims that MET DST transitions are the last week of
>> March, never the first week of April, anyway. There's something funny
>> going on there.

> Yes. I tried the example on 7.0.2 (and 7.1) and could not get it to
> misbehave. I was guessing that it involves string->date conversion,
> which may pass through timestamp to get there, but it looks like there
> is an explicit text->date conversion function so time zone should just
> never be involved. Really!

I dug through the conversions involved (basically date_in and date_out).
AFAICS the only place where timezone could possibly get involved is that
DecodeDateTime attempts to derive a timezone for the given date/time.
It does this by calling mktime() (line 878 in datetime.c in current
sources). If mktime() screws up and alters the tm->tm_mday field then
we'd see the reported behavior. I really don't see any other place that
it could be happening.

A platform-specific bug in mktime would do nicely to explain why we
can't reproduce the problem, too ... OTOH, it's hard to believe such a
bug would have persisted across several RedHat releases, which seems to
be necessary to explain the reports.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Lockhart 2001-05-01 00:55:55 Re: date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)
Previous Message Tom Lane 2001-04-30 23:12:16 Re: v7.1.1 branched and released on Tuesday ...

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-05-01 00:55:55 Re: date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)
Previous Message Hiroshi Inoue 2001-04-30 23:56:49 Re: [HACKERS] Bug in ODBC driver