From afbfc02983f86c4d71825efa6befd547fe81a926 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 13 Nov 2022 08:11:17 +0100 Subject: 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 Reviewed-by: Antonin Houska Discussion: https://www.postgresql.org/message-id/flat/95c30f96-4060-2f48-98b5-a4392d3b6066@enterprisedb.com --- src/backend/commands/operatorcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/operatorcmds.c') diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index a5924d7d564..a2d7ae89d74 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -481,7 +481,7 @@ AlterOperator(AlterOperatorStmt *stmt) } /* Check permissions. Must be owner. */ - if (!pg_oper_ownercheck(oprId, GetUserId())) + if (!object_ownercheck(OperatorRelationId, oprId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_OPERATOR, NameStr(oprForm->oprname)); -- cgit v1.2.3