Re: vacuumdb --missing-stats-only and permission issue - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: vacuumdb --missing-stats-only and permission issue
Date
Msg-id aKh4QIO0NoF7zyYL@nathan
Whole thread Raw
In response to Re: vacuumdb --missing-stats-only and permission issue  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: vacuumdb --missing-stats-only and permission issue
List pgsql-hackers
On Thu, Aug 21, 2025 at 07:27:23PM -0400, Corey Huinker wrote:
> Ok, I took the RLS and permissions quals from pg_stats and pg_stats_ext
> and put them in the corresponding EXISTs tests. The queries could be
> written a bit more succinctly (ex. we only need to do the RLS checks once)
> but putting them in each EXISTS clause drives home the point that we're
> duplicating the filters in pg_stats/pg_stats_ext.

Looks reasonable to me.  It's unfortunate that we have to be so
restrictive, but since this is primarily intended for administrators to use
post-upgrade, I think it's okay for v18.  For v19, perhaps we should
provide a view or function that returns whether stats are missing.  That
could require MAINTAIN on the relation to match what's needed for ANALYZE.

We'll also need documentation and test updates, of course.  For the docs,
I'd try to borrow some of the wording from pg_stats and pg_stats_ext:

    This view allows access only to rows of pg_statistic that correspond to
    tables the user has permission to read...

    This view allows access only to rows of pg_statistic_ext and
    pg_statistic_ext_data that correspond to tables the user owns...

-- 
nathan



pgsql-hackers by date:

Previous
From: Matheus Alcantara
Date:
Subject: Re: Potential problem in commit f777d773878 and 4f7f7b03758
Next
From: Richard Guo
Date:
Subject: Re: Remove unneeded cast in heap_xlog_lock.