Details

    • Task
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.6.0
    • JSON
    • None

    Description

      MySQL 8.0 has JSON_TABLE. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

      1. Syntax
      1.1 Standard compliance
       
      2. JSON_TABLE as table function
      3. Implementing a table function
      3.1 DDL considerations
      3.2 Producing the rows
      3.3 Interfacing with the optimizer
      3.3.1 Estimates 
      3.3.2 JSON_TABLE must be after its dependencies
      3.3.3 Can't use Join buffering 
      5. Links
      

      1. Syntax

      SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

      The syntax to be implemented is:

        JSON_TABLE(
          json_text,
          path COLUMNS(columns_list) 
        ) [AS] alias
      

      columns_list:  
        column [, column[, ... ]]
      

      column:
          name FOR ORDINALITY 
        | name type PATH path_str [on_empty_on_error]
        | name type EXISTS PATH path_str [on_empty_on_error]
        | NESTED PATH path COLUMNS (columns_list)
      

      on_empty_on_error:
        [ behavior ON EMPTY ] [ behavior ON ERROR ]
      

      behavior:
         ERROR | NULL | DEFAULT <value_expression>
      

      Here, JSON_TABLE(...) is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

      1.1 Standard compliance

      The above is a subset of the syntax allowed by the SQL Standard, with exception of name type EXISTS PATH path_str which is a non-standard extension in (Oracle database and Oracle MySQL?)

      2. JSON_TABLE as table function

      JSON_TABLE is the first table function - a table whose contents depends on its arguments.

      The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

      3. Implementing a table function

      3.1 DDL considerations

      A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

      TODO: At which point should this temporary table be created? It is apparent that this should happen before any Item::fix_fields() calls for the ON/WHERE/etc clauses. It should also happen before Item::fix_fields() calls made for the first parameter of any JSON_TABLE(...).

      3.1.2 Name resolution for JSON_TABLE argument

      The name resolution context should be ... "the same as for the ON expression" ?

      3.2 Producing the rows

      In order to produce rows, a Storage Engine will be implemented, ha_json_table. That is, the temporary table will use the ha_json_table engine.
      (This could be generalized to a generic ha_table_function Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

      The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

      3.3 Interfacing with the optimizer

      3.3.1 Estimates

      The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

      3.3.2 JSON_TABLE must be after its dependencies

      Second, the join optimizer will need to be aware that
      JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
      This will be done as follows:
      Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

      3.3.3 Can't use Join buffering

      Join buffering will be disabled for table JSON_TABLE(...).

      4. Producing JSON_TABLE contents

      4.1 FOR ORDINALITY columns

      The standard says:

      An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.

      The numbering seems to be "global", that is, it doesn't restart across table re-reads.

      4.2 NESTED contents

      The code has a "primary" JSON parser which scans through the JSON document and locates nodes that represent the rows to be produced by JSON_TABLE.
      In order to locate contents of the NESTED construct, we create another instance of JSON parser, point it at the current node, and then let it locate the pointed by the path. It's obvious that this can handle as many NESTED constructs as needed, and the "primary" parser state is not affected by them.

      5. Links

      Attachments

        Issue Links

          Activity

            diego dupin Diego Dupin created issue -
            diego dupin Diego Dupin made changes -
            Field Original Value New Value
            ralf.gebhardt Ralf Gebhardt made changes -
            Component/s JSON [ 13908 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            NRE Projects RM_105_CANDIDATE
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.5 [ 23123 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Alexey Botchkov [ holyfoot ]
            holyfoot Alexey Botchkov made changes -
            Due Date 2019-09-02
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            serg Sergei Golubchik made changes -
            Priority Critical [ 2 ] Major [ 3 ]
            holyfoot Alexey Botchkov made changes -
            Due Date 2019-09-02 2019-11-25
            julien.fritsch Julien Fritsch made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            julien.fritsch Julien Fritsch made changes -
            Due Date 2019-11-25
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2, and PostgreSQL 12

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2, and PostgreSQL 12

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            holyfoot Alexey Botchkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.5 [ 23123 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            julien.fritsch Julien Fritsch made changes -
            Assignee Sergei Petrunia [ psergey ] Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ] Alexey Botchkov [ holyfoot ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            holyfoot Alexey Botchkov made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            holyfoot Alexey Botchkov made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it is not in the 12th release?)

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            h2. JSON_TABLE as table function

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            h2. JSON_TABLE as table function

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. JSON_TABLE as table function

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. JSON_TABLE as table function

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.

            h2. Other notes
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.


            To implement this we create the new table handler that returns
            the calculated rows. Could be ha_table_function, bug now it's
            the ha_json_table as we don't have other table functions yet.
            The JSON_TABLE creates the temporary table of that ha_json_table
            type. We need to set dep_tables properly so this table is read
            tables mentioned in JSON_TABLE arguments are read, and any
            caching is disallowed for this table.
            BTW many IS tables can be easily redone with this new handler
            so no need to fill the memory tables.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. Implementing a table function

            h3. DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. Interfacing with the optimizer

            h4. Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            h2. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. Implementing a table function

            h3. DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. Interfacing with the optimizer

            h4. Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. Links
            * MySQL: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            4. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            4. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                path_expr,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            4. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            4. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents
            depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which
            causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str [on_empty] [on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty] [on_error]
              | name type EXISTS PATH path_str [on_empty] [on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}}
            engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            psergei Sergei Petrunia made changes -
            Assignee Sergei Petrunia [ psergey ] Alexey Botchkov [ holyfoot ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            holyfoot Alexey Botchkov made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)
             
            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            1.1 Standard compliance

            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)

            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            serg Sergei Golubchik made changes -
            Rank Ranked higher
            julien.fritsch Julien Fritsch made changes -
            Assignee Sergei Petrunia [ psergey ] Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ] Alexey Botchkov [ holyfoot ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            1.1 Standard compliance

            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)

            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            1.1 Standard compliance

            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)

            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h4 3.1.1 Steps

            TODO: How about references to columns of JSON_TABLE(...) which are not yet created? It possible?

            h4. 3.1.2

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            psergei Sergei Petrunia made changes -
            Description MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            1.1 Standard compliance

            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)

            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            h4 3.1.1 Steps

            TODO: How about references to columns of JSON_TABLE(...) which are not yet created? It possible?

            h4. 3.1.2

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            MySQL 8.0 has [JSON_TABLE|https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html]. These is also available in Oracle, DB2. (PostgreSQL has a patch under development but it seems it is not in the 12th or 13th release)

            {code}
            1. Syntax
            1.1 Standard compliance

            2. JSON_TABLE as table function
            3. Implementing a table function
            3.1 DDL considerations
            3.2 Producing the rows
            3.3 Interfacing with the optimizer
            3.3.1 Estimates
            3.3.2 JSON_TABLE must be after its dependencies
            3.3.3 Can't use Join buffering
            5. Links
            {code}

            h2. 1. Syntax

            SQL Standard defines a lot of features for JSON_TABLE. This task will implement a practically-important subset (roughly the same what MySQL-8 supports)

            The syntax to be implemented is:

            {code:sql}
              JSON_TABLE(
                json_text,
                path COLUMNS(columns_list)
              ) [AS] alias
            {code}

            {code:sql}
            columns_list:
              column [, column[, ... ]]
            {code}

            {code:sql}
            column:
                name FOR ORDINALITY
              | name type PATH path_str [on_empty_on_error]
              | name type EXISTS PATH path_str [on_empty_on_error]
              | NESTED PATH path COLUMNS (columns_list)
            {code}

            {code}
            on_empty_on_error:
              [ behavior ON EMPTY ] [ behavior ON ERROR ]
            {code}

            {code}
            behavior:
               ERROR | NULL | DEFAULT <value_expression>
            {code}

            Here, {{JSON_TABLE(...)}} is a table function and is allowed wherever a table reference is allowed, except for the context which imply that the referred table is to be modified.

            h3. 1.1 Standard compliance
            The above is a subset of the syntax allowed by the SQL Standard, with exception of {{name type EXISTS PATH path_str}} which is a non-standard extension in (Oracle database and Oracle MySQL?)

            h2. 2. JSON_TABLE as table function
            JSON_TABLE is the first *table function* - a table whose contents depends on its arguments.

            The arguments may be non-constant (e.g. columns of other tables), which causes the JSON_TABLE table to have LATERAL-like dependencies on its arguments.

            h2. 3. Implementing a table function

            h3. 3.1 DDL considerations

            A temporary table [definition] will be created with appropriate set of columns with appropriate attributes. This will allow for references to the columns of JSON_TABLE(...) to be resolved using the regular name resolution process.

            TODO: At which point should this temporary table be created? It is apparent that this should happen before any Item::fix_fields() calls for the ON/WHERE/etc clauses. It should also happen before Item::fix_fields() calls made for the first parameter of any JSON_TABLE(...).

            h4. 3.1.2 Name resolution for JSON_TABLE argument

            The name resolution context should be ... "the same as for the ON expression" ?

            h3. 3.2 Producing the rows

            In order to produce rows, a Storage Engine will be implemented, {{ha_json_table}}. That is, the temporary table will use the {{ha_json_table}} engine.
            (This could be generalized to a generic {{ha_table_function}} Storage Engine for table function, but it was decided not to do that until we have other examples of table functions).

            The engine will only support full table scans (rnd_init/rnd_next). rnd_init() call will implicitly evaluate the JSON_TABLE's parameters and set the storage engine to produce the rows that come from the parameters.

            h3. 3.3 Interfacing with the optimizer

            h4. 3.3.1 Estimates
            The optimizer will need to be aware that the table representing the output of JSON_TABLE(...) does not have any contents during the optimization phase. We will still need to provide some numbers for expected #rows and read_time. JSON documents are typically small, so a hard-coded constant describing a reasonably-sized JSON document would be sufficient.

            h4. 3.3.2 JSON_TABLE must be after its dependencies
            Second, the join optimizer will need to be aware that
            JSON_TABLE(tbl1.column_x, ... ) can only be accessed when the current row for table tbl1 is available.
            This will be done as follows:
            Table dependencies will be set such that JSON_TABLE(...) depends on tbl1.

            h4. 3.3.3 Can't use Join buffering
            Join buffering will be disabled for table JSON_TABLE(...).

            h2. 4. Producing JSON_TABLE contents

            h3. 4.1 FOR ORDINALITY columns
            The standard says:
            {quote}
            An ordinality column provides a sequential numbering of rows. Row numbering is 1-based.
            {quote}
            The numbering seems to be "global", that is, it doesn't restart across table re-reads.

            h3. 4.2 NESTED contents

            The code has a "primary" JSON parser which scans through the JSON document and locates nodes that represent the rows to be produced by JSON_TABLE.
            In order to locate contents of the NESTED construct, we create another instance of JSON parser, point it at the current node, and then let it locate the pointed by the path. It's obvious that this can handle as many NESTED constructs as needed, and the "primary" parser state is not affected by them.

            h2. 5. Links
            * JSON_TABLE in MySQL-8: https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html
            * SQL Standard: This page https://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
            has a link to http://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
            which in section 5.3.4 has a specification for JSON_TABLE function.
            * SQL:2016, as well as SQL Standard drafts from as early as 2014-11-10 cover JSON_TABLE.
            * PostgreSQL were working on this, see e.g. https://pgconf.ru/media/2019/02/20/postgresql-12-pgconfru-2019-v2.pdf , but currently they don't seem to have this.
            julien.fritsch Julien Fritsch made changes -
            julien.fritsch Julien Fritsch made changes -
            Assignee Sergei Petrunia [ psergey ] Alexey Botchkov [ holyfoot ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Alexey Botchkov [ holyfoot ] Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ] Alexey Botchkov [ holyfoot ]
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            psergei Sergei Petrunia made changes -
            Assignee Sergei Petrunia [ psergey ] Alexey Botchkov [ holyfoot ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            holyfoot Alexey Botchkov made changes -
            Assignee Alexey Botchkov [ holyfoot ] Sergei Petrunia [ psergey ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            psergei Sergei Petrunia made changes -
            Assignee Sergei Petrunia [ psergey ] Alexey Botchkov [ holyfoot ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Alexey Botchkov [ holyfoot ] Elena Stepanova [ elenst ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            psergei Sergei Petrunia made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ] Sergei Petrunia [ psergey ]
            psergei Sergei Petrunia made changes -
            Fix Version/s 10.6.0 [ 24431 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            greenman Ian Gilfillan made changes -
            markus makela markus makela made changes -
            deepak deepak made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 89978 ] MariaDB v4 [ 133710 ]
            alice Alice Sherepa made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Epic Link MDEV-17397 [ 70163 ]
            bar Alexander Barkov made changes -

            People

              psergei Sergei Petrunia
              diego dupin Diego Dupin
              Votes:
              31 Vote for this issue
              Watchers:
              32 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.