Re: vacuumdb --missing-stats-only and permission issue
Corey Huinker <corey.huinker@gmail.com>
From: Corey Huinker <corey.huinker@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-21T23:27:23Z
Lists: pgsql-hackers
Attachments
- v2-0001-Have-missing-stats-query-use-security-barrier-vie.patch (text/x-patch) patch v2-0001
> > 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). 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. So now, we avoid probing attributes for stats that we know were going to be filtered out, likewise for extended statistics objects. The queries don't consult pg_stats_exprs because that's just exposing different stats from the same pg_statistic_ext_data row, and we already know that the row is there or not.
Commits
-
Document privileges required for vacuumdb --missing-stats-only.
- 984d7165dde7 19 (unreleased) landed
- 6b34e2157539 18.0 landed