Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh0I6-00036J-C6 for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 00:32:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jh0I4-0003Eq-S4 for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 00:32:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh0I4-0003Ej-KV for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 00:32:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh0I2-00067e-5x for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 00:32:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0550WpTt1375426; Thu, 4 Jun 2020 20:32:51 -0400 From: Tom Lane To: Joe Abbate cc: pgsql-general@lists.postgresql.org Subject: Re: Binary encoding of TIMESTAMP WITH TIME ZONE In-reply-to: References: Comments: In-reply-to Joe Abbate message dated "Thu, 04 Jun 2020 20:24:50 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1375424.1591317171.1@sss.pgh.pa.us> Date: Thu, 04 Jun 2020 20:32:51 -0400 Message-ID: <1375425.1591317171@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Joe Abbate writes: > However, when using the same query using the Rust adapter the transition > to a new row started showing up after midgnight GMT. I opened an issue > on Github (https://github.com/sfackler/rust-postgres/issues/608 ) and > the maintainer claimed the Rust adapter *had* to initialize timezone to > UTC in order to properly convert "to and from time datatypes". I > pointed out that the timezone offset is available in psql and psycopg2, > but then he replied the binary encoding of timestamptz does *not* > include the timezone offset. Indeed it does not, just as the on-disk format for it does not. The representation is effectively always in UTC. If you have some other timezone setting selected, timestamptz_out rotates to that zone for display purposes ... but the binary format doesn't. regards, tom lane