pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Thomas Kellerer <shammat@gmx.net>
Cc: pgsql-jdbc@lists.postgresql.org <pgsql-jdbc@lists.postgresql.org>
Subject: Re: Startup parameters timezone conversion
Date: Wed, 19 Jan 2022 10:07:59 -0500
Message-ID: <505670.1642604879@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbhzmgRoEJwPzKPkzx_qtJkHAPZs3sAtWekaw3gkCk13g@mail.gmail.com>
References: <CA+g6ijixekZxJergSrkai=U++aj3FzzYyh3B6fFFMo3Yk6nSGw@mail.gmail.com>
	<CADK3HH+u1v+4rqCWrxEZAmUD5iNLK47x2iVmGeCJ0P4FhZ2G8Q@mail.gmail.com>
	<22f1218b-d700-141c-e9ef-08f7cb066411@gmx.net>
	<CAKFQuwbhzmgRoEJwPzKPkzx_qtJkHAPZs3sAtWekaw3gkCk13g@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Indeed I presume it is.  I wonder whether a carefully chosen timezone
> specification on the server would cause this to break since the server can
> be made to report the offset using either convention and so at least for
> some timezone specifications the flipping of the sign would not be required…

AFAIK, "reporting the offset" is always done with the ISO convention.
It's only when trying to interpret a time zone specification that
we consider the POSIX convention (and that's mostly because the
underlying tzdb code does so).  This does lead to fun stuff like

postgres=# set timezone = 'GMT+2';    -- read as POSIX zone spec
SET
postgres=# select now();
              now              
-------------------------------
 2022-01-19 13:03:36.000152-02        -- report as ISO
(1 row)

postgres=# set timezone = '+2';       -- read as numeric ISO offset
SET
postgres=# select now();
              now              
-------------------------------
 2022-01-19 17:03:41.722767+02        -- report as ISO
(1 row)

IMO, all these cases are best-avoided legacy conventions.
In practice you should set the timezone using the tzdb zone name
for where you live, e.g. America/New_York.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <505670.1642604879@sss.pgh.pa.us>
Permalink:  ../505670.1642604879@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/505670.1642604879@sss.pgh.pa.us

 · 

reply

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-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, shammat@gmx.net
  Subject: Re: Startup parameters timezone conversion
  In-Reply-To: <505670.1642604879@sss.pgh.pa.us>
  References: <CA+g6ijixekZxJergSrkai=U++aj3FzzYyh3B6fFFMo3Yk6nSGw@mail.gmail.com> <CADK3HH+u1v+4rqCWrxEZAmUD5iNLK47x2iVmGeCJ0P4FhZ2G8Q@mail.gmail.com> <22f1218b-d700-141c-e9ef-08f7cb066411@gmx.net> <CAKFQuwbhzmgRoEJwPzKPkzx_qtJkHAPZs3sAtWekaw3gkCk13g@mail.gmail.com> <505670.1642604879@sss.pgh.pa.us>

* 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