Re: ON ERROR in json_query and the like

2024-06-27 Thread Amit Langote
On Wed, Jun 26, 2024 at 9:10 PM Amit Langote wrote: > On Sat, Jun 22, 2024 at 5:43 PM Amit Langote wrote: > > On Fri, Jun 21, 2024 at 8:00 PM Markus Winand > > wrote: > > > So updating the three options: > > > > 1. Disallow anything but jsonb for context_item (the patch I posted > > > > yester

Re: ON ERROR in json_query and the like

2024-06-26 Thread Amit Langote
Hi, On Sat, Jun 22, 2024 at 5:43 PM Amit Langote wrote: > On Fri, Jun 21, 2024 at 8:00 PM Markus Winand wrote: > > So updating the three options: > > > 1. Disallow anything but jsonb for context_item (the patch I posted > > > yesterday) > > > > * Non-conforming > > * patch available > > > > > 2

Re: ON ERROR in json_query and the like

2024-06-22 Thread Amit Langote
Hi, Thanks all for chiming in. On Fri, Jun 21, 2024 at 8:00 PM Markus Winand wrote: > So updating the three options: > > 1. Disallow anything but jsonb for context_item (the patch I posted > > yesterday) > > * Non-conforming > * patch available > > > 2. Continue allowing context_item to be non-

Re: ON ERROR in json_query and the like

2024-06-21 Thread Markus Winand
> On 21.06.2024, at 07:38, David G. Johnston wrote: > > On Thursday, June 20, 2024, Markus Winand wrote: > > > > On 21.06.2024, at 06:46, David G. Johnston > > wrote: > >> > > > > > 2 also has the benefit of being standard conforming while 1 does not. > > Why do you think so? Do you ha

Re: ON ERROR in json_query and the like

2024-06-20 Thread David G. Johnston
On Thursday, June 20, 2024, Markus Winand wrote: > > > > On 21.06.2024, at 06:46, David G. Johnston > wrote: > >> > > > > > 2 also has the benefit of being standard conforming while 1 does not. > > Why do you think so? Do you have any references or is this just based on > previous statements in

Re: ON ERROR in json_query and the like

2024-06-20 Thread Markus Winand
> On 21.06.2024, at 06:46, David G. Johnston wrote: >> >> On Thursday, June 20, 2024, Pavel Stehule wrote: >> >> >> pá 21. 6. 2024 v 6:01 odesílatel Amit Langote >> napsal: >> On Fri, Jun 21, 2024 at 10:01 AM David G. Johnston >> wrote: >> >> > > By the standard, it is implementation-de

Re: ON ERROR in json_query and the like

2024-06-20 Thread Markus Winand
> On 21.06.2024, at 03:00, David G. Johnston wrote: > > On Thu, Jun 20, 2024 at 5:22 PM Amit Langote wrote: > > Soft error handling *was* used for catching cast errors in the very > early versions of this patch (long before I got involved and the > infrastructure you mention got added). It w

Re: ON ERROR in json_query and the like

2024-06-20 Thread David G. Johnston
On Thursday, June 20, 2024, Pavel Stehule wrote: > > > pá 21. 6. 2024 v 6:01 odesílatel Amit Langote > napsal: > >> On Fri, Jun 21, 2024 at 10:01 AM David G. Johnston >> wrote: >> >> > > By the standard, it is implementation-defined whether JSON parsing >> errors >> > > should be caught by ON E

Re: ON ERROR in json_query and the like

2024-06-20 Thread Pavel Stehule
pá 21. 6. 2024 v 6:01 odesílatel Amit Langote napsal: > On Fri, Jun 21, 2024 at 10:01 AM David G. Johnston > wrote: > > On Thu, Jun 20, 2024 at 5:22 PM Amit Langote > wrote: > >> > >> > >> Soft error handling *was* used for catching cast errors in the very > >> early versions of this patch (lon

Re: ON ERROR in json_query and the like

2024-06-20 Thread Pavel Stehule
pá 21. 6. 2024 v 2:22 odesílatel Amit Langote napsal: > On Fri, Jun 21, 2024 at 1:11 AM David G. Johnston > wrote: > > On Thu, Jun 20, 2024 at 2:19 AM Amit Langote > wrote: > >> On Mon, Jun 17, 2024 at 10:07 PM Markus Winand > wrote: > >> > > On 17.06.2024, at 08:20, Amit Langote > wrote: > >

Re: ON ERROR in json_query and the like

2024-06-20 Thread Amit Langote
On Fri, Jun 21, 2024 at 10:01 AM David G. Johnston wrote: > On Thu, Jun 20, 2024 at 5:22 PM Amit Langote wrote: >> >> >> Soft error handling *was* used for catching cast errors in the very >> early versions of this patch (long before I got involved and the >> infrastructure you mention got added)

Re: ON ERROR in json_query and the like

2024-06-20 Thread David G. Johnston
On Thu, Jun 20, 2024 at 5:22 PM Amit Langote wrote: > > Soft error handling *was* used for catching cast errors in the very > early versions of this patch (long before I got involved and the > infrastructure you mention got added). It was taken out after Pavel > said [1] that he didn't like prod

Re: ON ERROR in json_query and the like

2024-06-20 Thread Amit Langote
On Fri, Jun 21, 2024 at 1:11 AM David G. Johnston wrote: > On Thu, Jun 20, 2024 at 2:19 AM Amit Langote wrote: >> On Mon, Jun 17, 2024 at 10:07 PM Markus Winand >> wrote: >> > > On 17.06.2024, at 08:20, Amit Langote wrote: >> > > Agree that the documentation needs to be clear about this. I'll

Re: ON ERROR in json_query and the like

2024-06-20 Thread David G. Johnston
On Thu, Jun 20, 2024 at 2:19 AM Amit Langote wrote: > Hi, > > On Mon, Jun 17, 2024 at 10:07 PM Markus Winand > wrote: > > > On 17.06.2024, at 08:20, Amit Langote wrote: > > > Agree that the documentation needs to be clear about this. I'll update > > > my patch at [1] to add a note next to table

Re: ON ERROR in json_query and the like

2024-06-20 Thread Amit Langote
Hi, On Mon, Jun 17, 2024 at 10:07 PM Markus Winand wrote: > > On 17.06.2024, at 08:20, Amit Langote wrote: > > Agree that the documentation needs to be clear about this. I'll update > > my patch at [1] to add a note next to table 9.16.3. SQL/JSON Query > > Functions. > > Considering another bran

Re: ON ERROR in json_query and the like

2024-06-20 Thread Amit Langote
Hi, On Mon, Jun 17, 2024 at 9:47 PM Chapman Flack wrote: > On 06/17/24 02:20, Amit Langote wrote: > >>>Apparently, the functions expect JSONB so that a cast is implied > >>>when providing TEXT. However, the errors during that cast are > >>>not subject to the ON ERROR clause. > >>> > >

Re: ON ERROR in json_query and the like

2024-06-19 Thread jian he
On Mon, Jun 17, 2024 at 9:07 PM Markus Winand wrote: > > > I think it affects the following feature IDs: > > - T821, Basic SQL/JSON query operators > For JSON_VALUE, JSON_TABLE and JSON_EXISTS > - T828, JSON_QUERY > > Also, how hard would it be to add the functions that accept > character

Re: ON ERROR in json_query and the like

2024-06-18 Thread Amit Langote
On Mon, Jun 17, 2024 at 10:07 PM Markus Winand wrote: > > On 17.06.2024, at 08:20, Amit Langote wrote: > >>> 2. EMPTY [ARRAY|OBJECT] ON ERROR implies ERROR ON EMPTY > >>> > >>> 17beta1=# SELECT JSON_QUERY('[]', '$[*]' EMPTY ARRAY ON ERROR) a; > >>>a > >>> > >>>[] > >>> (1 row)

Re: ON ERROR in json_query and the like

2024-06-17 Thread Pavel Stehule
po 17. 6. 2024 v 15:07 odesílatel Markus Winand napsal: > > > On 17.06.2024, at 08:20, Amit Langote wrote: > > > > Hi, > > > > (apologies for not replying to this thread sooner) > > > > On Tue, May 28, 2024 at 6:57 PM Pavel Stehule > wrote: > >> út 28. 5. 2024 v 11:29 odesílatel Markus Winand <

Re: ON ERROR in json_query and the like

2024-06-17 Thread Markus Winand
> On 17.06.2024, at 08:20, Amit Langote wrote: > > Hi, > > (apologies for not replying to this thread sooner) > > On Tue, May 28, 2024 at 6:57 PM Pavel Stehule wrote: >> út 28. 5. 2024 v 11:29 odesílatel Markus Winand >> napsal: >>> >>> Hi! >>> >>> I’ve noticed two “surprising” (to me) b

Re: ON ERROR in json_query and the like

2024-06-17 Thread Chapman Flack
Hi, On 06/17/24 02:20, Amit Langote wrote: >>>Apparently, the functions expect JSONB so that a cast is implied >>>when providing TEXT. However, the errors during that cast are >>>not subject to the ON ERROR clause. >>> >>>17beta1=# SELECT JSON_QUERY('invalid', '$' NULL ON ERROR); >

Re: ON ERROR in json_query and the like

2024-06-16 Thread Amit Langote
Hi, (apologies for not replying to this thread sooner) On Tue, May 28, 2024 at 6:57 PM Pavel Stehule wrote: > út 28. 5. 2024 v 11:29 odesílatel Markus Winand > napsal: >> >> Hi! >> >> I’ve noticed two “surprising” (to me) behaviors related to >> the “ON ERROR” clause of the new JSON query func

Re: ON ERROR in json_query and the like

2024-06-12 Thread Markus Winand
> On 12.06.2024, at 15:31, David G. Johnston wrote: > > On Tuesday, May 28, 2024, Markus Winand wrote: > > 2. EMPTY [ARRAY|OBJECT] ON ERROR implies ERROR ON EMPTY > >17beta1=# SELECT JSON_QUERY('[]', '$[*]' EMPTY ARRAY ON ERROR) a; > a > > [] >(1 row) > >As NUL

Re: ON ERROR in json_query and the like

2024-06-12 Thread David G. Johnston
On Tuesday, May 28, 2024, Markus Winand wrote: > > 2. EMPTY [ARRAY|OBJECT] ON ERROR implies ERROR ON EMPTY > >17beta1=# SELECT JSON_QUERY('[]', '$[*]' EMPTY ARRAY ON ERROR) a; > a > > [] >(1 row) > >As NULL ON EMPTY is implied, it should give the same result as >ex

Re: ON ERROR in json_query and the like

2024-06-12 Thread Markus Winand
> On 04.06.2024, at 07:00, jian he wrote: > > On Tue, May 28, 2024 at 5:29 PM Markus Winand wrote: > >> 2. EMPTY [ARRAY|OBJECT] ON ERROR implies ERROR ON EMPTY >> >> 17beta1=# SELECT JSON_QUERY('[]', '$[*]' EMPTY ARRAY ON ERROR) a; >>a >> >>[] >> (1 row) >> >> As NULL O

Re: ON ERROR in json_query and the like

2024-06-12 Thread David G. Johnston
On Wednesday, June 12, 2024, Markus Winand wrote: > > > 10.14 SR 1: The declared type of the simply contained > in the immediately contained in the item> shall be a string type or a JSON type. > It might be best to think of it as two separate functions, overloaded: > > JSON_VALUE(context_item

Re: ON ERROR in json_query and the like

2024-06-12 Thread Markus Winand
> On 11.06.2024, at 03:58, jian he wrote: > > On Tue, May 28, 2024 at 5:29 PM Markus Winand wrote: >> >> Hi! >> >> I’ve noticed two “surprising” (to me) behaviors related to >> the “ON ERROR” clause of the new JSON query functions in 17beta1. >> >> 1. JSON parsing errors are not subject to

Re: ON ERROR in json_query and the like

2024-06-10 Thread jian he
On Tue, May 28, 2024 at 5:29 PM Markus Winand wrote: > > Hi! > > I’ve noticed two “surprising” (to me) behaviors related to > the “ON ERROR” clause of the new JSON query functions in 17beta1. > > 1. JSON parsing errors are not subject to ON ERROR >Apparently, the functions expect JSONB so that

Re: ON ERROR in json_query and the like

2024-06-03 Thread jian he
On Tue, May 28, 2024 at 5:29 PM Markus Winand wrote: > > Hi! > > I’ve noticed two “surprising” (to me) behaviors related to > the “ON ERROR” clause of the new JSON query functions in 17beta1. > > 1. JSON parsing errors are not subject to ON ERROR >Apparently, the functions expect JSONB so that

Re: ON ERROR in json_query and the like

2024-05-28 Thread Pavel Stehule
út 28. 5. 2024 v 11:29 odesílatel Markus Winand napsal: > Hi! > > I’ve noticed two “surprising” (to me) behaviors related to > the “ON ERROR” clause of the new JSON query functions in 17beta1. > > 1. JSON parsing errors are not subject to ON ERROR >Apparently, the functions expect JSONB so th

ON ERROR in json_query and the like

2024-05-28 Thread Markus Winand
Hi! I’ve noticed two “surprising” (to me) behaviors related to the “ON ERROR” clause of the new JSON query functions in 17beta1. 1. JSON parsing errors are not subject to ON ERROR Apparently, the functions expect JSONB so that a cast is implied when providing TEXT. However, the errors durin