← Back to team overview

maria-developers team mailing list archive

Re: MDEV-17399 Add support for JSON_TABLE: for ORDINALITY


Hi Alexey,

The standard says

"An ordinality column provides a sequential numbering of rows. Row numbering is

Consider this example from the standard:


  jt.rowseq, jt.name, jt.zip
  JSON_TABLE(bookclub.jcol, "lax $"
             COLUMNS ( rowSeq FOR ORDINALITY,
                      name VARCHAR(30) PATH 'lax $.Name',
                      zip CHAR(5) PATH 'lax $.address.postalCode')
            ) AS jt

| rowseq | name    | zip  |
|      0 | John Sm | 1    |
|      1 | Peter W | 9    |
|      2 | James L | NULL |

The numbering is 0-based, instead of 1-based.

What is not entirely clear for me is when the numbering should be reset.
For the above example, the SQL standard shows the resultset with rowseq 1-2-3
which hints that the numbering is "global".

MySQL-8 produces "1-1-1", which looks like they reset the numbering for every
scan of the JSON_TABLE output.

What are you thoughts on this?

If the numbering should be "global", should it be query-level global, or
subselect-level global?

Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog

Follow ups