pg-query-parser
pg-query-parser copied to clipboard
CREATE TRIGGER .... EXECUTE FUNCTION syntax not supported
In Postgres 13, you can say EXECUTE FUNCTION instead of EXECUTE PROCEDURE in CREATE TRIGGER. The two keywords are equivalent
https://www.postgresql.org/docs/13/sql-createtrigger.html In the syntax of CREATE TRIGGER, the keywords FUNCTION and PROCEDURE are equivalent, but the referenced function must in any case be a function, not a procedure. The use of the keyword PROCEDURE here is historical and deprecated.
However this currently throws, e.g.
CREATE TRIGGER tree_change_last_modified_trigger BEFORE UPDATE ON public.tree FOR EACH ROW EXECUTE FUNCTION public.change_last_modified()
{
error: Error: syntax error at or near "FUNCTION"
at Object.parse (/home/seve/workspace/os/worktree/node_modules/pg-query-native/index.js:12:17)
at Object.<anonymous> (/home/seve/workspace/os/worktree/db/breakdown-structuresql.js:12:24)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
fileName: 'scan.l',
lineNumber: 1116,
cursorPosition: 107,
functionName: 'scanner_yyerror',
context: null
},
query: []
}