diff options
| author | Peter Eisentraut | 2022-11-13 07:11:17 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2022-11-13 07:12:37 +0000 |
| commit | afbfc02983f86c4d71825efa6befd547fe81a926 (patch) | |
| tree | 0cff343b85d5c01fb022e0433d89f5d350609fd4 /src/backend/commands/vacuum.c | |
| parent | b4b7ce8061d34cea2b4915c41403b2a74d5fde0e (diff) | |
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 <[email protected]>
Reviewed-by: Antonin Houska <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/backend/commands/vacuum.c')
| -rw-r--r-- | src/backend/commands/vacuum.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 7ccde07de9c..3c8ea214753 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -565,14 +565,14 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, bits32 options) * * We allow the user to vacuum or analyze a table if he is superuser, the * table owner, or the database owner (but in the latter case, only if - * it's not a shared relation). pg_class_ownercheck includes the + * it's not a shared relation). object_ownercheck includes the * superuser case. * * Note we choose to treat permissions failure as a WARNING and keep * trying to vacuum or analyze the rest of the DB --- is this appropriate? */ - if (pg_class_ownercheck(relid, GetUserId()) || - (pg_database_ownercheck(MyDatabaseId, GetUserId()) && !reltuple->relisshared)) + if (object_ownercheck(RelationRelationId, relid, GetUserId()) || + (object_ownercheck(DatabaseRelationId, MyDatabaseId, GetUserId()) && !reltuple->relisshared)) return true; relname = NameStr(reltuple->relname); |
