Re: SQL/JSON: FOR ORDINALITY bug

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL/JSON: FOR ORDINALITY bug
Date: 2022-05-04 20:09:51
Message-ID: c225a643-ca4c-a94d-94b5-1430bc9ca905@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-05-04 20:43:00 Re: SQL/JSON: FOR ORDINALITY bug
Previous Message David G. Johnston 2022-05-04 19:49:35 Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?