diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml
index 9cbdcf91651503a2044b7ce5f4726ace10aed3f6..d799e466129e041270d8b8520aaf9adca3d523af 100644
--- a/doc/src/sgml/ref/create_trigger.sgml
+++ b/doc/src/sgml/ref/create_trigger.sgml
@@ -176,7 +176,8 @@ CREATE TRIGGER name { BEFORE | AFTE
To create a trigger on a table, the user must have the
- TRIGGER privilege on the table.
+ TRIGGER privilege on the table. The user must
+ also have EXECUTE privilege on the trigger function.
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 2fc35eed29bbf3ccbaf3eb676af5617719620dc0..ebc1cce09e9fd619ee71d4723a8ac10dbdd29c33 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -188,6 +188,10 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
* Find and validate the trigger function.
*/
funcoid = LookupFuncName(stmt->funcname, 0, fargtypes, false);
+ aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
+ if (aclresult != ACLCHECK_OK)
+ aclcheck_error(aclresult, ACL_KIND_PROC,
+ NameListToString(stmt->funcname));
funcrettype = get_func_rettype(funcoid);
if (funcrettype != TRIGGEROID)
{