Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability

Поиск
Список
Период
Сортировка
От Jeevan Chalke
Тема Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability
Дата
Msg-id CAM2+6=VP-i_gr=14SwQ1XwRSTeUJt8+Y95z2A76XQTzDknQVug@mail.gmail.com
обсуждение исходный текст
Ответ на Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers


On Tue, Feb 6, 2024 at 5:25 PM Andrew Dunstan <andrew@dunslane.net> wrote:


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.

Thanks for reporting Jian.

Added checkTimezoneIsUsedForCast() check where ever we are casting timezoned to non-timezoned types and vice-versa.

Thanks
 

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;



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


--
Jeevan Chalke
Principal, Manager
Product Development




edbpostgres.com
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Synchronizing slots from primary to standby
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: Synchronizing slots from primary to standby