Re: AT TIME ZONE: "convert"?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: AT TIME ZONE: "convert"?
Date: 2004-11-01 16:47:19
Message-ID: 14700.1099327639@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Mon, Nov 01, 2004 at 11:00:10AM -0500, Tom Lane wrote:
>> It does not really. By my reading of SQL99, the result should always be
>> timestamptz, and the behavior when the input is already timestamptz
>> should be that the new timezone spec is inserted while preserving the
>> same absolute time (UTC-equivalent timestamp).

> That's quite a different use of timestamptz. Does the SQL standard
> decide what defines a timestamp with a timezone, does it only allow
> the 'number of hours relative to UTC' or does it also allow different
> places in the world.

The SQL spec thinks that a timezone is a numeric offset from UTC, full stop.

My vision of what we will actually support is either numeric offsets or
named time zones --- basically, anything that you can now say either in
SET TIMEZONE or as a zone name in timestamptz input ought to work in
both places (as well as in AT TIME ZONE's second parameter). And a
stored timestamptz value ought to retain the full information about what
zone spec was given (for instance it should remember "PST8PDT" not just
"PST"). There was extensive discussion about this just last week.

> That's an interesting one, Is Australia/Sydney before or after
> Australia/Brisbane. It is questionable if there is any meaningful order
> to timezones. Alphabetical will make no-one happy, by
> longatude/latitude is way too complex. Maybe base offset, then
> alphabetical.

We can probably arrange to sort by UTC offset, but the sort order within
equal UTC offsets will likely be arbitrary (basically in order of the
numeric identifiers we assign to time zone names ... though that might
be user-configurable to some extent).

> It's a backward incompatable change (or is it?)

Some things will break, no doubt, but I don't think it will be too bad.
Certainly no worse than the changes we've made in these data types in
prior releases to move them closer to SQL spec.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vinko Vrsalovic 2004-11-01 16:57:38 Re: Daylight Savings Time handling on persistent connections
Previous Message Martijn van Oosterhout 2004-11-01 16:16:39 Re: AT TIME ZONE: "convert"?