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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, 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-22 00:50:54
Message-ID: ZJOa7nnnpQyEvyMW@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 21, 2023 at 09:26:09AM -0700, Jeff Davis wrote:
> What I meant is that if you do:
>
> CREATE TABLE p(i INT, j INT) PARTITION BY RANGE (i);
> CREATE TABLE p0 PARTITION OF p FOR VALUES FROM (00) TO (10);
> CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (10) TO (20);
> CREATE INDEX p_idx ON p (i);
> CREATE INDEX special_idx ON p0 (j);
> GRANT MAINTAIN ON p TO foo;
> \c - foo
> REINDEX TABLE p;
>
> That would reindex p0_i_idx and p1_i_idx, but skip special_idx. That
> might be too confusing, but feels a bit more consistent permissions-
> wise.

FWIW, the current behavior to reindex special_idx in this case feels
more natural to me, as the user requests a REINDEX at table-level, not
at index-level. This would mean to me that all the indexes of all the
partitions should be rebuilt on, not just the partitioned indexes that
are defined in the partitioned table requested for rebuild.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirk Wolak 2023-06-22 00:52:32 Re: Adding SHOW CREATE TABLE
Previous Message Andres Freund 2023-06-22 00:46:37 Re: vac_truncate_clog()'s bogus check leads to bogusness