Re: BUG #17687: Session timezone change does not play well with prepared statements
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #17687: Session timezone change does not play well with prepared statements |
| Дата | |
| Msg-id | 888267.1668435625@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | BUG #17687: Session timezone change does not play well with prepared statements (PG Bug reporting form <noreply@postgresql.org>) |
| Список | pgsql-bugs |
PG Bug reporting form <noreply@postgresql.org> writes:
> When a statement is prepared using one session timezone and executed using
> another, it returns the wrong timestamp.
> Example using psql:
> postgres=# SET TIMEZONE TO 'Europe/Berlin';
> SET
> postgres=# PREPARE test AS
> SELECT '2021-03-15 14:10:03'::timestamptz;
> PREPARE
> postgres=# SET TIMEZONE TO 'America/Chicago';
> SET
> postgres=# EXECUTE test;
> timestamptz
> ------------------------
> 2021-03-15 08:10:03-05
> (1 row)
That is not a bug, it's just how timestamptz works. You'd get the
same behavior if you stored the value into a table and then read
it out under another timezone setting. (Internally, the reason
is that the timestamptz literal is reduced to a Const on sight,
and stored that way in the prepared statement.)
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера