pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gary Bernhardt <gary.bernhardt@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Converting to UTC multiple times converts back to local time zone
Date: Mon, 25 Jun 2018 20:52:21 -0400
Message-ID: <22011.1529974341@sss.pgh.pa.us> (raw)
In-Reply-To: <1529973627.48469.1420256816.1159290F@webmail.messagingengine.com>
References: <1529970473.36096.1420218376.3C13DF11@webmail.messagingengine.com>
	<CAKFQuwYeHxefXOWmF_fXOM=MfR=QOz=Uas-HNz5_fA=R-koUfw@mail.gmail.com>
	<1529972735.44579.1420252720.11BFA61D@webmail.messagingengine.com>
	<CAKFQuwaUeC-VqtWDu_ASVGaWh1ktppF1HqN_5Nb16DRe6-AXOQ@mail.gmail.com>
	<1529973627.48469.1420256816.1159290F@webmail.messagingengine.com>

Gary Bernhardt <gary.bernhardt@gmail.com> writes:
> ... But I would never expect the value to switch back to
> local time when I add "AT TIME ZONE 'utc'".

It might help to understand that there's a difference between what
is stored and what is displayed.  For type timestamptz, what is
stored is an absolute point in time --- effectively "in UTC", though
I'm not sure that's the best way to think about it.  But for display
purposes, it's rotated into your session TimeZone setting.  That's
why an AT TIME ZONE conversion might appear to produce no change ---
the display conversion reverses what AT TIME ZONE did.

			regards, tom lane




view thread (8+ messages)  latest in thread

Message-ID: <22011.1529974341@sss.pgh.pa.us>
Permalink:  ../22011.1529974341@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22011.1529974341@sss.pgh.pa.us

 · 

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 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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gary.bernhardt@gmail.com, david.g.johnston@gmail.com
  Subject: Re: Converting to UTC multiple times converts back to local time zone
  In-Reply-To: <22011.1529974341@sss.pgh.pa.us>
  References: <1529970473.36096.1420218376.3C13DF11@webmail.messagingengine.com> <CAKFQuwYeHxefXOWmF_fXOM=MfR=QOz=Uas-HNz5_fA=R-koUfw@mail.gmail.com> <1529972735.44579.1420252720.11BFA61D@webmail.messagingengine.com> <CAKFQuwaUeC-VqtWDu_ASVGaWh1ktppF1HqN_5Nb16DRe6-AXOQ@mail.gmail.com> <1529973627.48469.1420256816.1159290F@webmail.messagingengine.com> <22011.1529974341@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