Skip to content

Commit

Permalink
Stabilize jsonb_path_query test case.
Browse files Browse the repository at this point in the history
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/ba8e1bc0-8a99-45b7-8397-3f2e94415e03@suse.de
  • Loading branch information
tglsfdc authored and pashkinelfe committed Nov 6, 2024
1 parent cd8124d commit 70b1ec3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/regress/expected/jsonb_jsonpath.out
Original file line number Diff line number Diff line change
Expand Up @@ -2634,12 +2634,16 @@ select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
"12:34:56+05:30"
(1 row)

-- this timetz usage will absorb the UTC offset of the current timezone setting
begin;
set local timezone = 'UTC-10';
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
jsonb_path_query_tz
---------------------
"12:34:56-07:00"
"12:34:56+10:00"
(1 row)

rollback;
select jsonb_path_query('"12:34:56"', '$.time().string()');
jsonb_path_query
------------------
Expand Down
4 changes: 4 additions & 0 deletions src/test/regress/sql/jsonb_jsonpath.sql
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz().string()')
select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp_tz().string()');
select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
-- this timetz usage will absorb the UTC offset of the current timezone setting
begin;
set local timezone = 'UTC-10';
select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
rollback;
select jsonb_path_query('"12:34:56"', '$.time().string()');
select jsonb_path_query('"2023-08-15"', '$.date().string()');

Expand Down

0 comments on commit 70b1ec3

Please sign in to comment.