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

From Corey Huinker
Subject Re: vacuumdb --missing-stats-only and permission issue
Date
Msg-id CADkLM=cXLUyr+2bO+ZkhV=U=Wc1GOgceaRp2CSMd0wvza-ow6g@mail.gmail.com
Whole thread Raw
In response to Re: vacuumdb --missing-stats-only and permission issue  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: vacuumdb --missing-stats-only and permission issue
List pgsql-hackers
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.
Attachment

pgsql-hackers by date:

Previous
From: "Matheus Alcantara"
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Next
From: Thomas Munro
Date:
Subject: Re: Redesigning postmaster death handling