Skip to content

xmltable(...) function support #1816

Closed
@lovasoa

Description

@lovasoa

Postgres, db2, and oracle all support the xmltable table-valued function.

SELECT xmltable.*
    FROM xmldata,
    XMLTABLE('//ROWS/ROW'
        PASSING data
            COLUMNS id int PATH '@id',
            ordinality FOR ORDINALITY,
            "COUNTRY_NAME" text,
            country_id text PATH 'COUNTRY_ID',
            size_sq_km float PATH 'SIZE[@unit = "sq_km"]',
            size_other text PATH 'concat(SIZE[@unit!="sq_km"], " ", SIZE[@unit!="sq_km"]/@unit)',
            premier_name text PATH 'PREMIER_NAME' DEFAULT 'not specified');

Currently, sqlparser fails to parse it with the following error: Expected: ), found: PASSING

https://www.postgresql.org/docs/15/functions-xml.html#FUNCTIONS-XML-PROCESSING

https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/XMLTABLE.html

https://www.ibm.com/docs/en/db2/12.1.0?topic=data-xmltable-function

Initially reported in sqlpage/SQLPage#887

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions