Re: SQL/JSON: FOR ORDINALITY bug - Mailing list pgsql-hackers

From Erik Rijkers
Subject Re: SQL/JSON: FOR ORDINALITY bug
Date
Msg-id c225a643-ca4c-a94d-94b5-1430bc9ca905@xs4all.nl
Whole thread Raw
In response to Re: SQL/JSON: FOR ORDINALITY bug  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: SQL/JSON: FOR ORDINALITY bug
Re: SQL/JSON: FOR ORDINALITY bug
List pgsql-hackers
Op 04-05-2022 om 21:12 schreef Andrew Dunstan:
> 
>>>>
>>>> I don't see how rowseq can be anything but 1.  Each invocation of
>>
>>
>> After some further experimentation, I now think you must be right, David.
>>
>> Also, looking at the DB2 docs:
>>    https://www.ibm.com/docs/en/i/7.2?topic=data-using-json-table
>>      (see especially under 'Handling nested information')
>>
>> There, I gathered some example data + statements where one is the case
>> at hand.  I also made them runnable under postgres (attached).
>>
>> I thought that was an instructive example, with those
>> 'outer_ordinality' and 'inner_ordinality' columns.
>>
>>
> 
> Yeah, I just reviewed the latest version of that page (7.5) and the
> example seems fairly plain that we are doing the right thing, or if not
> we're in pretty good company, so I guess this is probably a false alarm.
> Looks like ordinality is for the number of the element produced by the
> path expression. So a path of 'lax $' should just produce ordinality of
> 1 in each case, while a path of 'lax $[*]' will produce increasing
> ordinality for each element of the root array.

Agreed.

You've probably noticed then that on that same page under 'Sibling 
Nesting' is a statement that gives a 13-row resultset on DB2 whereas in 
15devel that statement yields just 10 rows.  I don't know which is correct.


Erik


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



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?
Next
From: "David G. Johnston"
Date:
Subject: Re: SQL/JSON: FOR ORDINALITY bug