From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-documentation <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: AT TIME ZONE correction |
Date: | 2018-09-01 23:37:36 |
Message-ID: | 20180901233736.GA25700@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
On Sat, Sep 1, 2018 at 07:30:43PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> 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 <bruce(at)momjian(dot)us> 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 +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2018-09-02 03:28:21 | Re: AT TIME ZONE correction |
Previous Message | Tom Lane | 2018-09-01 23:30:43 | Re: AT TIME ZONE correction |