Open seveibar opened 1 year ago
(@seamapi is open to sponsor this repo/fix)
Example failing syntax:
CREATE RULE override_insert AS ON INSERT TO public.events DO INSTEAD ( INSERT INTO public.events VALUES (NEW.*) RETURNING * );
CREATE RULE parsing tests/ast-capabilities.test.ts:6 5: const statements = 6: parse(`CREATE RULE override_insert AS ON INSERT TO public.events DO INSTEAD ( 7: INSERT INTO public.events Error thrown in test: Error { offset: 2, token: { col: 13, line: 1, lineBreaks: 0, offset: 12, text: 'override_insert', toString: Function tokenToString {}, type: 'word', value: 'override_insert', }, message: `Syntax error at line 1 col 13:␊ ␊ 1 VALUES (NEW.*)␊ ^␊ 2 RETURNING *␊ 3 );␊ Unexpected word token: "override_insert". I did not expect any more input. Here is the state of my parse table:␊ ␊ kw_view → %word ● ␊ kw_recursive → %word ● ␊ kw_global → %word ● ␊ kw_local → %word ● ␊ kw_unlogged → %word ● ␊ kw_index → %word ● ␊ kw_sequence → %word ● ␊ kw_temporary → %word ● ␊ kw_temp → %word ● ␊ kw_function → %word ● ␊ kw_extension → %word ● ␊ kw_type → %word ● ␊ kw_materialized → %word ● ␊ kw_schema → %word ● ␊ `, } › kw_schema → %word ● › Parser.feed (node_modules/nearley/lib/nearley.js:343:27) › _parse (node_modules/pgsql-ast-parser/src/parser.ts:110:16) › doParse (node_modules/pgsql-ast-parser/src/parser.ts:57:27) › parse (node_modules/pgsql-ast-parser/src/parser.ts:60:11) › <anonymous> (tests/ast-capabilities.test.ts:6:5)
(@seamapi is open to sponsor this repo/fix)
Example failing syntax: