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 1fnrsV-0006bf-C4 for pgsql-general@arkaria.postgresql.org; Thu, 09 Aug 2018 20:49:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnrsT-0003Rx-GH for pgsql-general@arkaria.postgresql.org; Thu, 09 Aug 2018 20:49:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnrsT-0003Rn-8g for pgsql-general@lists.postgresql.org; Thu, 09 Aug 2018 20:49:49 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fnrsQ-0001WR-3k for pgsql-general@postgresql.org; Thu, 09 Aug 2018 20:49:48 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1fnrsO-00063p-7Z; Thu, 09 Aug 2018 16:49:44 -0400 Date: Thu, 9 Aug 2018 16:49:44 -0400 From: Bruce Momjian To: Tom Lane Cc: Thomas Kellerer , pgsql-general@postgresql.org Subject: Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone? Message-ID: <20180809204944.GC14030@momjian.us> References: <65821.1530651617@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <65821.1530651617@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jul 3, 2018 at 05:00:17PM -0400, Tom Lane wrote: > Thomas Kellerer writes: > > A recent discussion around timestamptz behaviour has lead me to question my own understanding on how a TIMESTAMPTZ is converted to the session's time zone. > > I assumed this conversion happens *on the server* before the value is sent to the client. > > It's done in the datatype's output conversion function. > > > A co-worker of mine claims that this is purely a client side thing, and that the server will always send the "plain" UTC value that is stored in a timestamptz column. > > Your co-worker is certainly wrong so far as text output is concerned. > If you retrieve data in binary format, though, it looks like you get > the raw (un-rotated) timestamp value, so that any conversion would have > to be done on the client side. Wow, I am kind of surprised by that. Do any other data types have this behavior? -- Bruce Momjian 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 +