aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2011-12-20 00:05:19 +0200
committerPeter Eisentraut <peter_e@gmx.net>2011-12-20 00:05:19 +0200
commit729205571e81b4767efc42ad7beb53663e08d1ff (patch)
tree54081fe5cf5494bf77f0df20780b21288ba97411 /src/backend/executor/execMain.c
parent05e992e90e49aa5bca7e2b290ab736bfec97a7c1 (diff)
downloadpostgresql-729205571e81b4767efc42ad7beb53663e08d1ff.tar.gz
postgresql-729205571e81b4767efc42ad7beb53663e08d1ff.zip
Add support for privileges on types
This adds support for the more or less SQL-conforming USAGE privilege on types and domains. The intent is to be able restrict which users can create dependencies on types, which restricts the way in which owners can alter types. reviewed by Yeb Havinga
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 3dbd80d53bc..0cbe93c5c91 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -2490,6 +2490,21 @@ OpenIntoRel(QueryDesc *queryDesc)
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("ON COMMIT can only be used on temporary tables")));
+ {
+ AclResult aclresult;
+ int i;
+
+ for (i = 0; i < intoTupDesc->natts; i++)
+ {
+ Oid atttypid = intoTupDesc->attrs[i]->atttypid;
+
+ aclresult = pg_type_aclcheck(atttypid, GetUserId(), ACL_USAGE);
+ if (aclresult != ACLCHECK_OK)
+ aclcheck_error(aclresult, ACL_KIND_TYPE,
+ format_type_be(atttypid));
+ }
+ }
+
/*
* If a column name list was specified in CREATE TABLE AS, override the
* column names derived from the query. (Too few column names are OK, too