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

2025-08-26 Thread Nathan Bossart
On Tue, Aug 26, 2025 at 09:00:53PM +0900, Fujii Masao wrote: > On Tue, Aug 26, 2025 at 1:20 AM Nathan Bossart > wrote: >> Okay. I'll plan on committing the documentation update in the next 24-48 >> hours, provided no additional feedback materializes. > > The patch looks good to me. Thanks! Com

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

2025-08-26 Thread Fujii Masao
On Tue, Aug 26, 2025 at 1:20 AM Nathan Bossart wrote: > > On Tue, Aug 26, 2025 at 12:24:27AM +0900, Yugo Nagata wrote: > > Thank you for the clarification. I understand your points now, > > so I'll withdraw my proposal. > > Okay. I'll plan on committing the documentation update in the next 24-48

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

2025-08-25 Thread Nathan Bossart
On Tue, Aug 26, 2025 at 12:24:27AM +0900, Yugo Nagata wrote: > Thank you for the clarification. I understand your points now, > so I'll withdraw my proposal. Okay. I'll plan on committing the documentation update in the next 24-48 hours, provided no additional feedback materializes. -- nathan

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

2025-08-25 Thread Yugo Nagata
On Mon, 25 Aug 2025 09:29:15 -0500 Nathan Bossart wrote: > On Mon, Aug 25, 2025 at 10:30:32AM +0900, Yugo Nagata wrote: > > The documentation fix looks good to me. However, it’s not very > > user-friendly that, > > when the user lacks the required privileges, an error from the internal > > quer

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

2025-08-25 Thread Nathan Bossart
On Mon, Aug 25, 2025 at 10:30:32AM +0900, Yugo Nagata wrote: > The documentation fix looks good to me. However, it’s not very user-friendly > that, > when the user lacks the required privileges, an error from the internal query > is > raised. Instead, how about checking whether the user has the n

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

2025-08-24 Thread Yugo Nagata
On Sat, 23 Aug 2025 09:36:07 -0500 Nathan Bossart wrote: > On Sat, Aug 23, 2025 at 05:32:30AM -0400, Corey Huinker wrote: > > On Fri, Aug 22, 2025 at 11:20 PM Fujii Masao wrote: > >> On Sat, Aug 23, 2025 at 12:00 PM Nathan Bossart > >> wrote: > >>> Hm. Maybe we should just document that the o

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

2025-08-23 Thread Nathan Bossart
On Sat, Aug 23, 2025 at 05:32:30AM -0400, Corey Huinker wrote: > On Fri, Aug 22, 2025 at 11:20 PM Fujii Masao wrote: >> On Sat, Aug 23, 2025 at 12:00 PM Nathan Bossart >> wrote: >>> Hm. Maybe we should just document that the option requires SELECT >>> privileges on pg_statistic and pg_statistic

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

2025-08-23 Thread Corey Huinker
On Fri, Aug 22, 2025 at 11:20 PM Fujii Masao wrote: > On Sat, Aug 23, 2025 at 12:00 PM Nathan Bossart > wrote: > > > > On Sat, Aug 23, 2025 at 10:59:43AM +0900, Fujii Masao wrote: > > > I tested by creating many tables with make installcheck and running > > > vacuumdb --missing-stats-only on the

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

2025-08-22 Thread Fujii Masao
On Sat, Aug 23, 2025 at 12:00 PM Nathan Bossart wrote: > > On Sat, Aug 23, 2025 at 10:59:43AM +0900, Fujii Masao wrote: > > I tested by creating many tables with make installcheck and running > > vacuumdb --missing-stats-only on the regression database. > > Without the patch, the query to find tab

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

2025-08-22 Thread Nathan Bossart
On Sat, Aug 23, 2025 at 10:59:43AM +0900, Fujii Masao wrote: > I tested by creating many tables with make installcheck and running > vacuumdb --missing-stats-only on the regression database. > Without the patch, the query to find tables to analyze took about 60 ms, > but with the patch it took 18 s

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

2025-08-22 Thread Fujii Masao
On Sat, Aug 23, 2025 at 8:15 AM Corey Huinker wrote: > > On Fri, Aug 22, 2025 at 3:34 PM Nathan Bossart > wrote: >> >> On Fri, Aug 22, 2025 at 09:01:36AM -0500, Nathan Bossart wrote: >> > We'll also need documentation and test updates, of course. >> >> Here is an attempt at the docs/tests. I al

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

2025-08-22 Thread Corey Huinker
On Fri, Aug 22, 2025 at 3:34 PM Nathan Bossart wrote: > On Fri, Aug 22, 2025 at 09:01:36AM -0500, Nathan Bossart wrote: > > We'll also need documentation and test updates, of course. > > Here is an attempt at the docs/tests. I also fixed a couple of small > issues in the query. > > -- > nathan >

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

2025-08-22 Thread Nathan Bossart
On Fri, Aug 22, 2025 at 09:01:36AM -0500, Nathan Bossart wrote: > We'll also need documentation and test updates, of course. Here is an attempt at the docs/tests. I also fixed a couple of small issues in the query. -- nathan >From e75f534d4662a4c0ba3ee0518c08b3692cdc0255 Mon Sep 17 00:00:00 200

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

2025-08-22 Thread Nathan Bossart
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

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

2025-08-21 Thread Corey Huinker
> > 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

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

2025-08-21 Thread Nathan Bossart
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 c

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

2025-08-21 Thread Nathan Bossart
On Thu, Aug 21, 2025 at 12:52:17PM -0400, Corey Huinker wrote: > Here's the query changes, no regression test just yet. 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 MAIN

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

2025-08-21 Thread Corey Huinker
On Thu, Aug 21, 2025 at 9:44 AM Nathan Bossart wrote: > On Thu, Aug 21, 2025 at 03:19:40AM -0400, Corey Huinker wrote: > > Assuming that I'm not missing something, the fix seems straightforward. > > I'll set about coding it up tomorrow if nobody has done so by then. > > I've added an open item fo

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

2025-08-21 Thread Nathan Bossart
On Thu, Aug 21, 2025 at 03:19:40AM -0400, Corey Huinker wrote: > Assuming that I'm not missing something, the fix seems straightforward. > I'll set about coding it up tomorrow if nobody has done so by then. I've added an open item for this. -- nathan

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

2025-08-21 Thread Corey Huinker
On Wed, Aug 20, 2025 at 11:06 PM Fujii Masao wrote: > > I'm not sure whether --missing-stats-only was intended to work for > non-superusers, but if so, this restriction is inconvenient. Would it > make sense to use the views pg_stats and pg_stats_ext instead? > Since the catalogs are only consult