pgsql-ast-parser icon indicating copy to clipboard operation
pgsql-ast-parser copied to clipboard

Statements with `ON CONFLICT ON CONSTRAINT` fail to parse

Open valeneiko opened this issue 3 years ago • 0 comments

Parsing:

INSERT INTO foo (c1)
VALUES (1), (2)
ON CONFLICT ON CONSTRAINT bar DO NOTHING;

Fails with:

Error: Syntax error at line 3 col 13:

  ON CONFLICT ON
              ^
Unexpected kw_on token: "on". Instead, I was expecting to see one of the following:

    - A "kw_do" token
    - A "lparen" token
    - A "kw_do" 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)

valeneiko avatar Jun 29 '22 11:06 valeneiko