public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bruce Momjian <[email protected]>
To: Tom Lane <[email protected]>
Cc: PostgreSQL-documentation <[email protected]>
Subject: Re: AT TIME ZONE correction
Date: Sat, 1 Sep 2018 19:37:36 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
On Sat, Sep 1, 2018 at 07:30:43PM -0400, Tom Lane wrote:
> Bruce Momjian <[email protected]> writes:
> > Looking over the AT TIME ZONE docs, I think they are subtly confusing.
> > The order of conversion specific in the first example should _start_
> > with the assumption of local time zone for the time stamp, not something
> > that happens after AT TIME ZONE is applied. The ordering in current
> > docs makes the second example confusing too.
>
> > The attached patch fixes this.
>
> I think it's you that are confused. The text as written is correct,
> or at least arguably so; your revision is definitely incorrect.
>
> SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST';
>
> The way I'd describe this is that we start with a timestamp,
> which has no particular timezone. The AT TIME ZONE says "Assume that
> this zoneless timestamp is in MST, and convert it to timestamp with
> time zone (which will be in UTC, internally)". Then after that, the
> UTC timestamptz value is converted to PST8PDT for display purposes,
> but that's done by timestamptz_out not AT TIME ZONE.
>
> If we were going from PST to MST as your patch describes it, the
> output would be one hour later not one hour earlier than the input.
>
> SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST';
>
> Here we've got a time value that was initially given in EST (-05),
> but was converted to UTC by timestampz_in. Then the AT TIME ZONE
> says "Please convert this UTC value to MST, and emit it as a zoneless
> timestamp" (which will not be subject to any further conversion when
> it's displayed).
>
> The existing text is indeed a bit deficient, because it fails to
> draw a clear boundary between what the AT TIME ZONE operator is
> doing and what is being done by the timestamp(tz) I/O functions.
> But you're not making it better.
Yes, I am still researching and realize my diff is wrong. Let me keep
working and I will repost.
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
view thread (8+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: AT TIME ZONE correction
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox