Re: Inconsistent time zone output for JSON at UTC

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Inconsistent time zone output for JSON at UTC
Дата
Msg-id CAKFQuwaDa9R9SKhKS8t4RsKto0rXK3EHjbcv6QUEso3oeLzL_w@mail.gmail.com
обсуждение исходный текст
Ответ на Inconsistent time zone output for JSON at UTC  (Gregory Jensen <GreatDJonfire@hotmail.co.uk>)
Ответы Re: Inconsistent time zone output for JSON at UTC  (Gregory Jensen <greatdjonfire@hotmail.co.uk>)
Re: Inconsistent time zone output for JSON at UTC  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Tuesday, May 31, 2022, Gregory Jensen <GreatDJonfire@hotmail.co.uk> wrote:

When the server time zone setting is UTC - timezone = 'UTC'

select to_json(created_at::timestamptz) from test_tz;
              to_json              
------------------------------------
 "2022-05-31T10:20:07.133799+00:00"
(1 row)

This is the solution.  The timezone setting isn't a “server setting”, it is a session-local setting with an initial value based upon server configuration.  Change it for the session to UTC if you for some reason must output +00.

The at time zone operator outputs a timestamp without timezone and that is why those variants don’t produce any time zone offset.

David J.

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

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: psql 15beta1 does not print notices on the console until transaction completes
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #17485: Records missing from Primary Key index when doing REINDEX INDEX CONCURRENTLY