mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Change PROCEDURE to FUNCTION in CREATE TRIGGER syntax
Since procedures are now a different thing from functions, change the CREATE TRIGGER and CREATE EVENT TRIGGER syntax to use FUNCTION in the clause that specifies the function. PROCEDURE is still accepted for compatibility. pg_dump and ruleutils.c output is not changed yet, because that would require a change in information_schema.sql and thus a catversion change. Reported-by: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Jonathan S. Katz <jonathan.katz@excoventures.com>
This commit is contained in:
@@ -5344,7 +5344,7 @@ CreateAmStmt: CREATE ACCESS METHOD name TYPE_P INDEX HANDLER handler_name
|
||||
CreateTrigStmt:
|
||||
CREATE TRIGGER name TriggerActionTime TriggerEvents ON
|
||||
qualified_name TriggerReferencing TriggerForSpec TriggerWhen
|
||||
EXECUTE PROCEDURE func_name '(' TriggerFuncArgs ')'
|
||||
EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
|
||||
{
|
||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||
n->trigname = $3;
|
||||
@@ -5366,7 +5366,7 @@ CreateTrigStmt:
|
||||
| CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
|
||||
qualified_name OptConstrFromTable ConstraintAttributeSpec
|
||||
FOR EACH ROW TriggerWhen
|
||||
EXECUTE PROCEDURE func_name '(' TriggerFuncArgs ')'
|
||||
EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
|
||||
{
|
||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||
n->trigname = $4;
|
||||
@@ -5504,6 +5504,11 @@ TriggerWhen:
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
;
|
||||
|
||||
FUNCTION_or_PROCEDURE:
|
||||
FUNCTION
|
||||
| PROCEDURE
|
||||
;
|
||||
|
||||
TriggerFuncArgs:
|
||||
TriggerFuncArg { $$ = list_make1($1); }
|
||||
| TriggerFuncArgs ',' TriggerFuncArg { $$ = lappend($1, $3); }
|
||||
|
||||
Reference in New Issue
Block a user