Skip to content

Commit 70b1ec3

Browse files
tglsfdcpashkinelfe
authored andcommitted
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 ed055d249 failed to consider this. Per report from Bernhard Wiedemann. Back-patch to v17, as the test case was. Discussion: https://postgr.es/m/[email protected]
1 parent cd8124d commit 70b1ec3

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)