Skip to content

xmltable(...) function support #1816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lovasoa opened this issue Apr 18, 2025 · 0 comments · May be fixed by #1817
Open

xmltable(...) function support #1816

lovasoa opened this issue Apr 18, 2025 · 0 comments · May be fixed by #1817

Comments

@lovasoa
Copy link
Contributor

lovasoa commented Apr 18, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant