From: Joe Abbate <jma@freedomcircle.com>
To: pgsql-general@lists.postgresql.org
Subject: Binary encoding of TIMESTAMP WITH TIME ZONE
Date: Thu, 4 Jun 2020 20:24:50 -0400
Message-ID: <ae9774ef-ad25-a0bc-6f4b-208ba1880b3a@freedomcircle.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: jma@freedomcircle.com
Subject: Re: Binary encoding of TIMESTAMP WITH TIME ZONE
In-Reply-To: <ae9774ef-ad25-a0bc-6f4b-208ba1880b3a@freedomcircle.com>
References: <ae9774ef-ad25-a0bc-6f4b-208ba1880b3a@freedomcircle.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox