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

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

> 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.

Yes. It is possible to call DecodeDateTime() so that it *never* tries to
derive a time zone (call with the last argument set to NULL), but that
also causes it to reject date/time strings which have an explicit time
zone. We certainly would want to accept something like

select date('1993-04-02 04:05:06 PST');

(even though for a date-only result it is overspecified), so calling
with NULL is not the right thing to do (I tried it, then realized the
bad effect).

> 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.

It is also hard to see how such a bug would not be similarly manifested
in Mandrake, Debian, etc etc.

For this particular problem, I'd like to see the "DateStyle" setting,
the time zone setting, an example of the problem (does not require a
table, but just a date string conversion), and the output of "zdump -v"
for the timezone in question.

I'm not sure how to handle date/time bug reports which are not
reproducible on our machines. Certainly date/time issues are the most
problematic in terms of number of bug reports, but they are also
probably the most sensitive to machine configuration and user's
location, so all in all I think the types are doing very well. I don't
want to sound complacent, but it is probably sufficient to fix
reproducible problems to keep our date/time data types viable, and we
are doing far more than that over time :)

- Thomas

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fazal Majid 2001-05-01 01:05:21 Problem building PostgreSQL 7.1 with readline-4.2
Previous Message Tom Lane 2001-05-01 00:51:58 date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2001-05-01 01:31:48 Re: COPY commands could use an enhancement.
Previous Message Tom Lane 2001-05-01 00:51:58 date conversion (was Re: Re: v7.1.1 branched and released on Tuesday ...)