Converting to UTC multiple times converts back to local time zone

Поиск
Список
Период
Сортировка
От Gary Bernhardt
Тема Converting to UTC multiple times converts back to local time zone
Дата
Msg-id 1529970473.36096.1420218376.3C13DF11@webmail.messagingengine.com
обсуждение исходный текст
Ответы Re: Converting to UTC multiple times converts back to local time zone  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
now() is local, as I expect:

testdb=# select now();
2018-06-25 16:41:28.037072-07

And converting to UTC does convert to UTC:

testdb=# select now() at time zone 'utc';
2018-06-25 23:41:23.700795

But converting that timestamp to UTC a second time converts back to local:

testdb=# select (now() at time zone 'utc') at time zone 'utc';
2018-06-25 16:43:03.200762-07

This seems to happen regardless of where the UTC timestamp comes from. Here's the same thing done with a subquery:

testdb=# select (ts at time zone 'utc') from (select now() at time zone 'utc' as ts) as t1;
2018-06-25 16:44:05.219322-07

This seems very wrong to me. But this also seems like something that would have been exercised many, many times in the wild.

I'd expect "converting" a UTC timestamp to UTC would keep it in UTC. Am I missing something?

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

Предыдущее
От: csusza
Дата:
Сообщение: Re: Crashed libpq.dll in a multithreaded environment in case of SSLconnection + callstack
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Converting to UTC multiple times converts back to local time zone