Skip to content
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

CREATE TRIGGER .... EXECUTE FUNCTION syntax not supported #29

Open
seveibar opened this issue Aug 22, 2021 · 0 comments
Open

CREATE TRIGGER .... EXECUTE FUNCTION syntax not supported #29

seveibar opened this issue Aug 22, 2021 · 0 comments

Comments

@seveibar
Copy link

seveibar commented Aug 22, 2021

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: []
}
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

No branches or pull requests

1 participant