Re: Converting to UTC multiple times converts back to local time zone

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Gary Bernhardt <gary(dot)bernhardt(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Converting to UTC multiple times converts back to local time zone
Date: 2018-06-26 01:03:22
Message-ID: CAKFQuwaEA0XLWTpBG7aqZ_qz3FDT_E54zjXfhfRfoxzskd_B5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 25, 2018 at 5:52 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> timestamptz AT TIME ZONE's usefulness is marginal at best - and in any
> case should not be used in subqueries. Pass the original timestamptz typed
> value around until you are ready to send it to the user.
>

​Just to clarify that a bit - usually query results as passed to another
layer which then presents the results to a person. Pass that layer a
timestamptz and let it decide how to deal with presentation. If psql is
used as the client presentation layer then you will need to use AT TIME
ZONE (or TimeZone GUC depending on the situation) but that still falls
within the general idea of pushing display as close to the user as possible.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-06-26 06:02:04 Re: BUG #15252: "do not dump comments" in pg_restore help
Previous Message David G. Johnston 2018-06-26 00:52:47 Re: Converting to UTC multiple times converts back to local time zone