Skip to content

Commit a358019

Browse files
committed
Stabilize jsonb_path_query test case.
An operation like '12:34:56'::time_tz takes the UTC offset from the prevailing time zone, which means that the results change across DST transitions. One of the test cases added in ed055d2 failed to consider this. Per report from Bernhard Wiedemann. Back-patch to v17, as the test case was. Discussion: https://postgr.es/m/ba8e1bc0-8a99-45b7-8397-3f2e94415e03@suse.de
1 parent c177726 commit a358019

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/test/regress/expected/jsonb_jsonpath.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,12 +2634,16 @@ select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
26342634
"12:34:56+05:30"
26352635
(1 row)
26362636

2637+
-- this timetz usage will absorb the UTC offset of the current timezone setting
2638+
begin;
2639+
set local timezone = 'UTC-10';
26372640
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
26382641
jsonb_path_query_tz
26392642
---------------------
2640-
"12:34:56-07:00"
2643+
"12:34:56+10:00"
26412644
(1 row)
26422645

2646+
rollback;
26432647
select jsonb_path_query('"12:34:56"', '$.time().string()');
26442648
jsonb_path_query
26452649
------------------

src/test/regress/sql/jsonb_jsonpath.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,11 @@ select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz().string()')
596596
select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp_tz().string()');
597597
select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
598598
select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
599+
-- this timetz usage will absorb the UTC offset of the current timezone setting
600+
begin;
601+
set local timezone = 'UTC-10';
599602
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
603+
rollback;
600604
select jsonb_path_query('"12:34:56"', '$.time().string()');
601605
select jsonb_path_query('"2023-08-15"', '$.date().string()');
602606

0 commit comments

Comments
 (0)