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

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: vacuumdb --missing-stats-only and permission issue
Date: 2025-08-22 14:01:36
Message-ID: aKh4QIO0NoF7zyYL@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-08-22 14:01:41 Re: Remove unneeded cast in heap_xlog_lock.
Previous Message Matheus Alcantara 2025-08-22 13:33:52 Re: Potential problem in commit f777d773878 and 4f7f7b03758