Re: Startup parameters timezone conversion

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Startup parameters timezone conversion
Дата
Msg-id 505670.1642604879@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Startup parameters timezone conversion  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Startup parameters timezone conversion
Список pgsql-jdbc
"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



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Startup parameters timezone conversion
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Startup parameters timezone conversion