From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com> |
Subject: | Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability |
Date: | 2024-02-06 11:55:36 |
Message-ID: | bbc33586-21cf-8d27-14e5-44e152131c7f@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2024-02-05 Mo 22:06, jian he wrote:
>
> Hi.
> this commit [0] changes immutability of jsonb_path_query,
> jsonb_path_query_first? If so, it may change other functions also.
>
> demo:
>
> begin;
> SET LOCAL TIME ZONE 10.5;
> with cte(s) as (select jsonb '"2023-08-15 12:34:56 +05:30"')
>
> select jsonb_path_query(s,
> '$.timestamp_tz()')::text,'+10.5'::text,'timestamp_tz'::text from cte
> union all
> select jsonb_path_query(s, '$.time()')::text,'+10.5'::text,
> 'time'::text from cte
> union all
> select jsonb_path_query(s,
> '$.timestamp()')::text,'+10.5'::text,'timestamp'::text from cte
> union all
> select jsonb_path_query(s, '$.date()')::text,'+10.5'::text,
> 'date'::text from cte
> union all
> select jsonb_path_query(s, '$.time_tz()')::text,'+10.5'::text,
> 'time_tz'::text from cte;
>
> SET LOCAL TIME ZONE -8;
> with cte(s) as (select jsonb '"2023-08-15 12:34:56 +05:30"')
> select jsonb_path_query(s,
> '$.timestamp_tz()')::text,'-8'::text,'timestamp_tz'::text from cte
> union all
> select jsonb_path_query(s, '$.time()')::text,'-8'::text, 'time'::text
> from cte
> union all
> select jsonb_path_query(s,
> '$.timestamp()')::text,'-8'::text,'timestamp'::text from cte
> union all
> select jsonb_path_query(s, '$.date()')::text,'-8'::text, 'date'::text
> from cte
> union all
> select jsonb_path_query(s, '$.time_tz()')::text,'-8'::text,
> 'time_tz'::text from cte;
> commit;
>
>
> [0]
> https://git.postgresql.org/cgit/postgresql.git/commit/?id=66ea94e8e606529bb334515f388c62314956739e
ouch. Good catch. Clearly we need to filter these like we do for the
.datetime() method.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2024-02-06 11:58:50 | Re: Memory leak fix in rmtree.c |
Previous Message | Ильясов Ян | 2024-02-06 11:45:31 | RE: Memory leak fix in rmtree.c |