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 1jh0AN-0002nS-Dv for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 00:24:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jh0AM-0003Px-6e for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 00:24:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh0AL-0003Pp-Uw for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 00:24:57 +0000 Received: from freedomcircle.com ([208.71.169.155] helo=mail.freedomcircle.com) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jh0AI-00032A-Ta for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 00:24:57 +0000 Received: from [192.168.1.7] (unknown [173.169.83.47]) by mail.freedomcircle.com (Postfix) with ESMTPSA id 888452A0AD for ; Fri, 5 Jun 2020 00:24:51 +0000 (UTC) To: pgsql-general@lists.postgresql.org From: Joe Abbate Subject: Binary encoding of TIMESTAMP WITH TIME ZONE Message-ID: Date: Thu, 4 Jun 2020 20:24:50 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I'm dealing with an issue where a query uses 'today'::date to select one of a number of rows depending on the day modulo the number of rows. The intent is that different information will be shown starting after midnight local time. The query runs as expected in psql and using psycopg2. 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. He pointed me to the function timestamptz_send() which per the comments "converts timestamptz to binary format". I found that the TimestampTz used in the function is a typedef for an int64, but since I'm not familiar with the code, I can't tell if timezone offset is embedded in there or not. I'm hoping someone reading this can confirm (or deny) the above (or do I need to ask the -hackers list?). Regards, Joe