Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fXcDf-0006Xi-Rt for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jun 2018 00:52:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fXcDb-0005XB-QB for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jun 2018 00:52:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fXcDb-0005X3-DN for pgsql-bugs@lists.postgresql.org; Tue, 26 Jun 2018 00:52:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fXcDY-0006cc-If for pgsql-bugs@lists.postgresql.org; Tue, 26 Jun 2018 00:52:25 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5Q0qLYI031812; Mon, 25 Jun 2018 20:52:21 -0400 From: Tom Lane To: Gary Bernhardt cc: "David G. Johnston" , pgsql-bugs@lists.postgresql.org Subject: Re: Converting to UTC multiple times converts back to local time zone In-reply-to: <1529973627.48469.1420256816.1159290F@webmail.messagingengine.com> References: <1529970473.36096.1420218376.3C13DF11@webmail.messagingengine.com> <1529972735.44579.1420252720.11BFA61D@webmail.messagingengine.com> <1529973627.48469.1420256816.1159290F@webmail.messagingengine.com> Comments: In-reply-to Gary Bernhardt message dated "Mon, 25 Jun 2018 17:40:27 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22010.1529974341.1@sss.pgh.pa.us> Date: Mon, 25 Jun 2018 20:52:21 -0400 Message-ID: <22011.1529974341@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Gary Bernhardt 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