mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user