aboutsummaryrefslogtreecommitdiff
path: root/src/backend/catalog/pg_aggregate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/catalog/pg_aggregate.c')
-rw-r--r--src/backend/catalog/pg_aggregate.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index c28f29e13ff..faf7238a716 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.69 2004/12/31 21:59:38 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.69.4.1 2005/01/27 23:42:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,10 +22,13 @@
#include "catalog/pg_aggregate.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
+#include "miscadmin.h"
#include "optimizer/cost.h"
#include "parser/parse_coerce.h"
#include "parser/parse_func.h"
+#include "utils/acl.h"
#include "utils/builtins.h"
+#include "utils/lsyscache.h"
#include "utils/syscache.h"
@@ -262,6 +265,7 @@ lookup_agg_function(List *fnName,
bool retset;
Oid *true_oid_array;
FuncDetailCode fdresult;
+ AclResult aclresult;
/*
* func_get_detail looks up the function in the catalogs, does
@@ -326,5 +330,10 @@ lookup_agg_function(List *fnName,
errmsg("function %s requires run-time type coercion",
func_signature_string(fnName, nargs, true_oid_array))));
+ /* Check aggregate creator has permission to call the function */
+ aclresult = pg_proc_aclcheck(fnOid, GetUserId(), ACL_EXECUTE);
+ if (aclresult != ACLCHECK_OK)
+ aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(fnOid));
+
return fnOid;
}