Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Ted Yu <yuzhihong(at)gmail(dot)com>, Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX
Date: 2023-06-20 22:52:57
Message-ID: 20230620225257.GA771663@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've attached rebased versions of the remaining two patches.

On Tue, Jun 20, 2023 at 11:43:05AM -0700, Jeff Davis wrote:
> * REINDEX TABLE applies to all indexes in all partitions, which seems
> a bit inconsistent.
>
> The only behavior I'm worried about is REINDEX. I'm not sure what we
> should do about it, or if we even want to do something about it. If we
> want REINDEX to fail in this case, we should be sure to check
> permissions on everything up-front to avoid doing a lot of work. The
> only other option I can think of is to REINDEX only those indexes
> declared on the partitioned table (not the individual partitions),
> which seems consistent but might be confusing to users.

At the moment, I think I'm inclined to call this "existing behavior" since
we didn't check privileges for each partition in this case even before
MAINTAIN was introduced. IIUC we still process the individual partitions
in v15 regardless of whether the calling user owns the partition.

However, I do agree that it feels inconsistent. Besides the options you
proposed, we might also consider making REINDEX work a bit more like VACUUM
and ANALYZE and emit a WARNING for any relations that the user is not
permitted to process. But this probably deserves its own thread, and it
might even need to wait until v17.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v7-0001-partial-revert-of-ff9618e82a.patch text/x-diff 21.6 KB
v7-0002-simplify-privilege-related-documentation-for-main.patch text/x-diff 8.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-06-20 22:53:52 Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX
Previous Message Nathan Bossart 2023-06-20 22:20:24 Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX