Re: Redhat 7.3 time manipulation bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: cbbrowne(at)cbbrowne(dot)com, Thomas Lockhart <lockhart(at)fourpalms(dot)org>, PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Redhat 7.3 time manipulation bug
Date: 2002-05-24 17:51:01
Message-ID: 12998.1022262661@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)com> writes:
> I don't understand precisely what need to be done, but I'll give it a
> shot if you get me pointed in the right direction.
> <downloads and looks at code>
> I see that tzcode2002c.tar.gz includes a mktime() function. Is the idea
> to pull this out (with just whatever support it needs), incorporate it
> into PostgreSQL source (perhaps in a new src/backend/utils/tz directory)
> and use this in place of the system provided mktime()?

Well, that's the zeroth-order approximation. We should take the
opportunity to get out from under the mktime()/tzset() API. The real
idea here is to make use of the timezone database info in the ways that
Postgres needs. Some things that are not good about mktime()/tzset():

* Arbitrary restrictions on range of dates. We certainly don't want to
be limited by a 32-bit time_t, whether you think it's signed or not.
The APIs should be recast in terms of PG's preferred internal
representations. (Lockhart would be the man to point you in the right
direction here, not me.)

* No way to tell whether a user-provided timezone name is actually good.

* No support for concurrent access to multiple zones, short of flushing
all memory of one zone to load the next. Although we do not really need
this now, I can foresee wanting it. I'd be inclined to store all the
info about a particular zone in some struct that can be referenced by
a pointer; that would give us the flexibility to have multiple such
structs floating around a backend in the future (perhaps living in a
hashtable indexed by timezone name?)

My guess is that we want to borrow the parts of the tzcode library that
are associated with reading a tz database file and loading it into some
suitable internal representation; there's probably not a lot else that
we'll want to use as-is.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-05-24 19:02:57 Tcl build fix attempted
Previous Message Gunther Schadow 2002-05-24 17:43:36 Alternatives to SQL ...