Re: vacuumdb --missing-stats-only and permission issue

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-21T18:07:10Z
Lists: pgsql-hackers
On Thu, Aug 21, 2025 at 12:59:52PM -0500, Nathan Bossart wrote:
> I think there's a problem with the privilege checks for pg_stats (and
> friends) versus ANALYZE.  pg_stats checks for SELECT privileges on the
> column, while ANALYZE checks for MAINTAIN privileges.  If a role lacks
> SELECT on the columns, it will always try to analyze the table.  If a role
> lacks MAINTAIN on the table, it will fail if it tries to analyze the table.

Unfortunately, pg_stats_ext is also different.  The data for that view is
restricted to table owners (or roles that inherit privileges of the table
owner).

-- 
nathan



Commits

  1. Document privileges required for vacuumdb --missing-stats-only.