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/tsearchcmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/tsearchcmds.c') diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index 4cc4e3c00f8..365bfd30fdf 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -510,7 +510,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt) dictId); /* must be owner */ - if (!pg_ts_dict_ownercheck(dictId, GetUserId())) + if (!object_ownercheck(TSDictionaryRelationId, dictId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_TSDICTIONARY, NameListToString(stmt->dictname)); @@ -1124,7 +1124,7 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt) cfgId = ((Form_pg_ts_config) GETSTRUCT(tup))->oid; /* must be owner */ - if (!pg_ts_config_ownercheck(cfgId, GetUserId())) + if (!object_ownercheck(TSConfigRelationId, cfgId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_TSCONFIGURATION, NameListToString(stmt->cfgname)); -- cgit v1.2.3