Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af21152

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 763d65a commit af21152

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
@@ -2684,12 +2684,16 @@ select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
26842684
"12:34:56+05:30"
26852685
(1 row)
26862686

2687+
-- this timetz usage will absorb the UTC offset of the current timezone setting
2688+
begin;
2689+
set local timezone = 'UTC-10';
26872690
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
26882691
jsonb_path_query_tz
26892692
---------------------
2690-
"12:34:56-07:00"
2693+
"12:34:56+10:00"
26912694
(1 row)
26922695

2696+
rollback;
26932697
select jsonb_path_query('"12:34:56"', '$.time().string()');
26942698
jsonb_path_query
26952699
------------------

src/test/regress/sql/jsonb_jsonpath.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,11 @@ select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz().string()')
607607
select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp_tz().string()');
608608
select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
609609
select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
610+
-- this timetz usage will absorb the UTC offset of the current timezone setting
611+
begin;
612+
set local timezone = 'UTC-10';
610613
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
614+
rollback;
611615
select jsonb_path_query('"12:34:56"', '$.time().string()');
612616
select jsonb_path_query('"2023-08-15"', '$.date().string()');
613617

0 commit comments

Comments
 (0)