mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Refactor ownercheck functions
Instead of dozens of mostly-duplicate pg_foo_ownercheck() functions, write one common function object_ownercheck() that can handle almost all of them. We already have all the information we need, such as which system catalog corresponds to which catalog table and which column is the owner column. Reviewed-by: Corey Huinker <corey.huinker@gmail.com> Reviewed-by: Antonin Houska <ah@cybertec.at> Discussion: https://www.postgresql.org/message-id/flat/95c30f96-4060-2f48-98b5-a4392d3b6066@enterprisedb.com
This commit is contained in:
@ -371,7 +371,7 @@ AlterCollation(AlterCollationStmt *stmt)
|
||||
(errmsg("cannot refresh version of default collation"),
|
||||
errhint("Use ALTER DATABASE ... REFRESH COLLATION VERSION instead.")));
|
||||
|
||||
if (!pg_collation_ownercheck(collOid, GetUserId()))
|
||||
if (!object_ownercheck(CollationRelationId, collOid, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_COLLATION,
|
||||
NameListToString(stmt->collname));
|
||||
|
||||
|
Reference in New Issue
Block a user