From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Timestamp with vs without time zone.
Date: Tue, 21 Sep 2021 17:49:21 -0400
Message-ID: <2060278.1632260961@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZoiV=N9sWXMvonqu7uuRrdqhYjkCXC8jAWzruUPd+-_g@mail.gmail.com>
References: <CAGuHJrNeP8H-J9LD-pwO5gaNhSSKSgfn=oBKrH5-ifyoy+WgrA@mail.gmail.com>
<trinity-8442e59f-d55e-42a5-8699-47be32a9b347-1632209999042@3c-app-gmx-bap35>
<YUmbZHqaq+NGLC1B@hjp.at>
<CAGuHJrOVrgpxazJqKxyHsu99T9KCBmp+Zh-=9jHsdCy++W50JQ@mail.gmail.com>
<YUoUSiOJDKAijVoE@hjp.at>
<CADK3HHLtfoTC9W5v19uE9qzNT7vPvhkDeqbuhm66nTurfmyv4Q@mail.gmail.com>
<YUoY6fCbTm/AGKve@hjp.at>
<CADK3HHJD2RNh7iOHEK=dCqSBM2+hPR-0iTsSuYN2x-7KzxZKwQ@mail.gmail.com>
<YUooOlUZrmcJKHAg@hjp.at>
<4a195869-f9ed-c39b-4070-e882b546d7fd@aklaver.com>
<YUo3dIa6YmbJWohW@hjp.at>
<CAKFQuwZoiV=N9sWXMvonqu7uuRrdqhYjkCXC8jAWzruUPd+-_g@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, September 21, 2021, Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
>> These two values are completely indistinguishable. That's good for a
>> timestamp (they are the same time after all). But they are not a
>> "timestamp with time zone". The time zone is not part of the value but
>> of the environment.
> No, it’s inherent to the data type itself. The data type has an implied
> time zone of UTC. That is a reasonable definition of “with” in my book.
The SQL standard is pretty clear that they intend "timestamp with time
zone" to include a time zone represented by a specific UTC offset.
We didn't implement it that way, which is not great, but with
twenty-some years of history there it seems unlikely that we'll change.
Especially since the SQL spec hasn't exactly covered itself with glory
in terms of providing *useful* datetime types. (Anybody ever found a
use for timetz?)
I think there is plenty of application for timestamps that actually
include (civil) time zones. Calendaring, for example. If I make an
appointment to see a friend at 2PM some months from now, it's
understood that that's in the local time zone; if some lawmakers take
it on themselves to fool with the DST rules before then, we're still
going to meet at 2PM local time. And it'd be useful to know whether
that now conflicts with appointments defined by reference to some
other zone, so the easy way of "assume it's all local time" doesn't
cut it.
This same example demonstrates why the SQL spec's idea of "timestamp
with time zone" doesn't cut it. You really need some DST-aware notion
of timezone identity. But, as already covered upthread, the can of
worms that that opens is so large that nobody has wanted to try to
tackle it as a primitive Postgres datatype.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
Subject: Re: Timestamp with vs without time zone.
In-Reply-To: <2060278.1632260961@sss.pgh.pa.us>
References: <CAGuHJrNeP8H-J9LD-pwO5gaNhSSKSgfn=oBKrH5-ifyoy+WgrA@mail.gmail.com> <trinity-8442e59f-d55e-42a5-8699-47be32a9b347-1632209999042@3c-app-gmx-bap35> <YUmbZHqaq+NGLC1B@hjp.at> <CAGuHJrOVrgpxazJqKxyHsu99T9KCBmp+Zh-=9jHsdCy++W50JQ@mail.gmail.com> <YUoUSiOJDKAijVoE@hjp.at> <CADK3HHLtfoTC9W5v19uE9qzNT7vPvhkDeqbuhm66nTurfmyv4Q@mail.gmail.com> <YUoY6fCbTm/AGKve@hjp.at> <CADK3HHJD2RNh7iOHEK=dCqSBM2+hPR-0iTsSuYN2x-7KzxZKwQ@mail.gmail.com> <YUooOlUZrmcJKHAg@hjp.at> <4a195869-f9ed-c39b-4070-e882b546d7fd@aklaver.com> <YUo3dIa6YmbJWohW@hjp.at> <CAKFQuwZoiV=N9sWXMvonqu7uuRrdqhYjkCXC8jAWzruUPd+-_g@mail.gmail.com> <2060278.1632260961@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox