mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Simplify WARNING messages from skipped vacuum/analyze on a table
This will more easily accomodate adding new permissions for vacuum and analyze. Nathan Bossart following a suggestion from Kyotaro Horiguchi Discussion: https://postgr.es/m/20220726.104712.912995710251150228.horikyota.ntt@gmail.com
This commit is contained in:
@@ -579,18 +579,9 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, bits32 options)
|
||||
|
||||
if ((options & VACOPT_VACUUM) != 0)
|
||||
{
|
||||
if (reltuple->relisshared)
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only superuser can vacuum it",
|
||||
relname)));
|
||||
else if (reltuple->relnamespace == PG_CATALOG_NAMESPACE)
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it",
|
||||
relname)));
|
||||
else
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only table or database owner can vacuum it",
|
||||
relname)));
|
||||
ereport(WARNING,
|
||||
(errmsg("permission denied to vacuum \"%s\", skipping it",
|
||||
relname)));
|
||||
|
||||
/*
|
||||
* For VACUUM ANALYZE, both logs could show up, but just generate
|
||||
@@ -601,20 +592,9 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, bits32 options)
|
||||
}
|
||||
|
||||
if ((options & VACOPT_ANALYZE) != 0)
|
||||
{
|
||||
if (reltuple->relisshared)
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only superuser can analyze it",
|
||||
relname)));
|
||||
else if (reltuple->relnamespace == PG_CATALOG_NAMESPACE)
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only superuser or database owner can analyze it",
|
||||
relname)));
|
||||
else
|
||||
ereport(WARNING,
|
||||
(errmsg("skipping \"%s\" --- only table or database owner can analyze it",
|
||||
relname)));
|
||||
}
|
||||
ereport(WARNING,
|
||||
(errmsg("permission denied to analyze \"%s\", skipping it",
|
||||
relname)));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user