From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | bart(at)lengkeek(dot)net |
Subject: | BUG #17687: Session timezone change does not play well with prepared statements |
Date: | 2022-11-14 07:20:57 |
Message-ID: | 17687-97355f89274fa9a3@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17687
Logged by: Bart Lengkeek
Email address: bart(at)lengkeek(dot)net
PostgreSQL version: 15.1
Operating system: Linux (Ubuntu 20.04.5 LTS)
Description:
When a statement is prepared using one session timezone and executed using
another, it returns the wrong timestamp.
Example using psql:
=====================================================
psql (15.1 (Ubuntu 15.1-1.pgdg20.04+1))
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)
postgres=# SELECT '2021-03-15 14:10:03'::timestamptz;
timestamptz
------------------------
2021-03-15 14:10:03-05
(1 row)
=====================================================
The "EXECUTE test" should return the same as the unprepared execution of the
same statement, "2021-03-15 14:10:03-05" instead of "2021-03-15
08:10:03-05".
The same behavior happens for protocol level prepared statements. That's
actually how I found out about this strange behavior. It also applies to
server version 13.9.
Thnx for looking into this.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2022-11-14 11:38:15 | Re: WAL segments removed from primary despite the fact that logical replication slot needs it. |
Previous Message | Kyotaro Horiguchi | 2022-11-14 02:52:56 | Re: BUG #17684: pg_rewind ---could not receive data from WAL stream: ERROR: requested WAL segment 00000005000000000 |