oguimbal/pgsql-ast-parser

Select statements with CTEs containing column names fail to parse

Opened this issue · 0 comments

Parsing:

WITH cte(bar) AS (
    SELECT *
    FROM foo
)
SELECT *
FROM cte;

Fails with:

Error: Syntax error at line 1 col 9:

  WITH cte(
          ^
Unexpected lparen token: "(". Instead, I was expecting to see one of the following:

    - A "kw_as" token


    at Parser.feed (/src/node_modules/nearley/lib/nearley.js:343:27)
    at _parse (/src/node_modules/pgsql-ast-parser/src/parser.ts:110:16)
    at doParse (/src/node_modules/pgsql-ast-parser/src/parser.ts:57:27)
    at Object.parse (/src/node_modules/pgsql-ast-parser/src/parser.ts:60:11)