Subject: Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability

From: Jeevan Chalke <[email-masked]>
Date: Thu, 8 Feb 2024 10:57:04 +0530

On Wed, Feb 7, 2024 at 9:13 PM jian he <[email-masked]> wrote:

> On Wed, Feb 7, 2024 at 7:36 PM Jeevan Chalke
> <[email-masked]> wrote:
> > Added checkTimezoneIsUsedForCast() check where ever we are casting
> timezoned to non-timezoned types and vice-versa.
>
> https://www.postgresql.org/docs/devel/functions-json.html
> above Table 9.51. jsonpath Filter Expression Elements, the Note
> section, do we also need to rephrase it?
>

OK. Added a line for the same.

Thanks

-- 
Jeevan Chalke

*Principal, ManagerProduct Development*

edbpostgres.com

---

From: jian he <[email-masked]>
Date: Thu, 8 Feb 2024 16:52:00 +0800

On Thu, Feb 8, 2024 at 1:27 PM Jeevan Chalke
<[email-masked]> wrote:
>> > Added checkTimezoneIsUsedForCast() check where ever we are casting timezoned to non-timezoned types and vice-versa.
>>

diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 6788ba8..37ae2d1 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -18240,7 +18240,11 @@ ERROR:  jsonpath member accessor can only be
applied to an object
       <type>timestamptz</type>, and <type>time</type> to <type>timetz</type>.
       However, all but the first of these conversions depend on the current
       <xref linkend="guc-timezone"/> setting, and thus can only be performed
-      within timezone-aware <type>jsonpath</type> functions.
+      within timezone-aware <type>jsonpath</type> functions.  Similarly, other
+      date/time-related methods that convert string to the date/time types
+      also do the casting and may involve the current
+      <xref linkend="guc-timezone"/>.  To preserve the immutability, those can
+      only be performed within timezone-aware <type>jsonpath</type> functions.
      </para>
     </note>

my proposed minor changes:
-      within timezone-aware <type>jsonpath</type> functions.
+      within timezone-aware <type>jsonpath</type> functions. Similarly, other
+      date/time-related methods that convert string to the date/time types
+      also do the casting and may involve the current
+      <xref linkend="guc-timezone"/> setting. Those conversions can
+      only be performed within timezone-aware <type>jsonpath</type> functions.
I don't have a strong opinion, though.

---

From: Jeevan Chalke <[email-masked]>
Date: Fri, 9 Feb 2024 07:32:50 +0530

> I don't have a strong opinion, though.

That seems fine as well. Let's leave that to the committer.

Thanks
-- 
Jeevan Chalke

edbpostgres.com

---

From: Andrew Dunstan <[email-masked]>
Date: Sat, 10 Feb 2024 12:24:58 -0500

On 2024-02-08 Th 21:02, Jeevan Chalke wrote:
>     >> > Added checkTimezoneIsUsedForCast() check where ever we are
>     casting timezoned to non-timezoned types and vice-versa.
>     >>
I edited slightly to my taste, and committed the patch. Thanks.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

---

From: Jeevan Chalke <[email-masked]>
Date: Tue, 13 Feb 2024 18:34:27 +0530

> I edited slightly to my taste, and committed the patch. Thanks.

Thank you, Andrew and Jian.

>
> cheers
>
>
> andrew
>
> --
> Andrew Dunstan
> EDB: https://www.enterprisedb.com
>
>

-- 
Jeevan Chalke

edbpostgres.com