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 1faSPX-0004IZ-C2 for pgsql-general@arkaria.postgresql.org; Tue, 03 Jul 2018 21:00:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1faSPU-0006UF-Vb for pgsql-general@arkaria.postgresql.org; Tue, 03 Jul 2018 21:00:28 +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 1faSPU-0006U6-OO for pgsql-general@lists.postgresql.org; Tue, 03 Jul 2018 21:00:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faSPR-0006DS-JS for pgsql-general@postgresql.org; Tue, 03 Jul 2018 21:00:28 +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 w63L0HBn008709; Tue, 3 Jul 2018 17:00:17 -0400 From: Tom Lane To: Thomas Kellerer cc: pgsql-general@postgresql.org Subject: Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone? In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Tue, 03 Jul 2018 22:55:51 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <65820.1530651617.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 03 Jul 2018 17:00:17 -0400 Message-ID: <65821.1530651617@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 t= ime zone. > I assumed this conversion happens *on the server* before the value is se= nt 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. regards, tom lane