REPACK (CONCURRENTLY) fails with wrong error for materialized views
Hi,
REPACK (CONCURRENTLY) fails with a confusing "no identity index" error
when a materialized view is specified. Please find attached a patch
that reports a proper error, similar to the other cases in
check_concurrent_repack_requirements(), and adds a note to the docs. I
think this needs to be backpatched to PG19.
Thoughts?
[1]: postgres=# CREATE MATERIALIZED VIEW m AS SELECT 1 AS a; SELECT 1 postgres=# REPACK (CONCURRENTLY) m; ERROR: cannot execute REPACK (CONCURRENTLY) on relation "m" HINT: Relation "m" has no identity index.
postgres=# CREATE MATERIALIZED VIEW m AS SELECT 1 AS a;
SELECT 1
postgres=# REPACK (CONCURRENTLY) m;
ERROR: cannot execute REPACK (CONCURRENTLY) on relation "m"
HINT: Relation "m" has no identity index.
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Hi Bharath,
I verified the change, and it works as intended. The new check is
appropriately placed before replica identity validation. The error is much
clearer than the previous "has no identity index" message, and the
documentation update looks good to me.
*My only suggestion is to add an automated* test as it can help catch any
future regressions in this behavior.
*Verified Upstream Commit* - ec13f71049cda06ea55a67783b822d98824f4d15
*Build Status -* Successfully built with assertions enabled. No relevant
compiler warnings were observed.
*Automated Tests Validation -* The complete test suite passed which
includes the related wal level tests.
*Manual Verifications - *Verified that REPACK (CONCURRENTLY) succeeded on
a regular table and preserved all rows. For both populated and unpopulated
materialized views, it returned the expected error and the new
materialized-view-specific hint that you introduced.
Thanks,
Kiran Kaki.
On Sat, Aug 29, 2026 at 8:58 AM Bharath Rupireddy <
bharath.rupireddyforpostgres@gmail.com> wrote:
Show quoted text
Hi,
REPACK (CONCURRENTLY) fails with a confusing "no identity index" error
when a materialized view is specified. Please find attached a patch
that reports a proper error, similar to the other cases in
check_concurrent_repack_requirements(), and adds a note to the docs. I
think this needs to be backpatched to PG19.Thoughts?
[1]
postgres=# CREATE MATERIALIZED VIEW m AS SELECT 1 AS a;
SELECT 1
postgres=# REPACK (CONCURRENTLY) m;
ERROR: cannot execute REPACK (CONCURRENTLY) on relation "m"
HINT: Relation "m" has no identity index.--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Hi,
On Sat, Aug 29, 2026 at 1:42 PM Kiran Kaki <itskkpg@gmail.com> wrote:
Hi Bharath,
I verified the change, and it works as intended. The new check is appropriately placed before replica identity validation. The error is much clearer than the previous "has no identity index" message, and the documentation update looks good to me.
My only suggestion is to add an automated test as it can help catch any future regressions in this behavior.
Thanks for reviewing and verifying the change. I think we can skip the
test for this one since the change is straightforward and unlikely to
regress.
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
@Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> look like you
intended to share something, but email body just says hi.
On Mon, Aug 31, 2026, 9:11 AM Bharath Rupireddy <
bharath.rupireddyforpostgres@gmail.com> wrote:
Show quoted text
Hi,
On Sat, Aug 29, 2026 at 1:42 PM Kiran Kaki <itskkpg@gmail.com> wrote:
Hi Bharath,
I verified the change, and it works as intended. The new check is
appropriately placed before replica identity validation. The error is much
clearer than the previous "has no identity index" message, and the
documentation update looks good to me.My only suggestion is to add an automated test as it can help catch any
future regressions in this behavior.
Thanks for reviewing and verifying the change. I think we can skip the
test for this one since the change is straightforward and unlikely to
regress.--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Hi Bharath,
Ignore my previous reply. Looks like an issue with the gmail client.
Adding a test should be quick and I can help re-validate as a second eye,
but I would let committer to take a call on this based followed practices.
Otherwise the change is good.
Thanks,
Kiran Kaki.
On Mon, Aug 31, 2026, 1:21 PM Kiran Kaki <itskkpg@gmail.com> wrote:
Show quoted text
@Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> look like you
intended to share something, but email body just says hi.On Mon, Aug 31, 2026, 9:11 AM Bharath Rupireddy <
bharath.rupireddyforpostgres@gmail.com> wrote:Hi,
On Sat, Aug 29, 2026 at 1:42 PM Kiran Kaki <itskkpg@gmail.com> wrote:
Hi Bharath,
I verified the change, and it works as intended. The new check is
appropriately placed before replica identity validation. The error is much
clearer than the previous "has no identity index" message, and the
documentation update looks good to me.My only suggestion is to add an automated test as it can help catch
any future regressions in this behavior.
Thanks for reviewing and verifying the change. I think we can skip the
test for this one since the change is straightforward and unlikely to
regress.--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
On 2026-Aug-29, Bharath Rupireddy wrote:
REPACK (CONCURRENTLY) fails with a confusing "no identity index" error
when a materialized view is specified. Please find attached a patch
that reports a proper error, similar to the other cases in
check_concurrent_repack_requirements(), and adds a note to the docs. I
think this needs to be backpatched to PG19.
I think this should reuse errdetail_relkind_not_supported(). I would
add a trivial test as Kiran Kaki suggested though.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Most hackers will be perfectly comfortable conceptualizing users as entropy
sources, so let's move on." (Nathaniel Smith)
https://mail.gnu.org/archive/html/monotone-devel/2007-01/msg00080.html
Hi,
On Mon, Aug 31, 2026 at 1:41 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
On 2026-Aug-29, Bharath Rupireddy wrote:
REPACK (CONCURRENTLY) fails with a confusing "no identity index" error
when a materialized view is specified. Please find attached a patch
that reports a proper error, similar to the other cases in
check_concurrent_repack_requirements(), and adds a note to the docs. I
think this needs to be backpatched to PG19.I think this should reuse errdetail_relkind_not_supported().
Yes, that's better, let's reuse.
I would
add a trivial test as Kiran Kaki suggested though.
That's fine with me, I can add one for materialized views here in this
patch. Going by this, I think we also need tests for catalogs, TOAST,
and other repack-restricted cases. I'd let Kiran Kaki add such tests
in a new thread.
Thoughts?
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Hi,
On Mon, Aug 31, 2026 at 1:50 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
I think this should reuse errdetail_relkind_not_supported().
Yes, that's better, let's reuse.
I would
add a trivial test as Kiran Kaki suggested though.That's fine with me, I can add one for materialized views here in this
patch.
Please find the attached v2.
Going by this, I think we also need tests for catalogs, TOAST,
and other repack-restricted cases. I'd let Kiran Kaki add such tests
in a new thread.
I realized that except for the wal_level and replica identity related
errors, repack seems to already have tests for the other restricted
cases.
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
On 2026-Aug-31, Bharath Rupireddy wrote:
Thoughts?
Hello, thanks, I have pushed this. I removed the CREATE INDEX from the
test case though, because it's not needed: the new error fires before
even trying to find the index. I also moved to the start of the list
the documentation addition: the new sentence was the only "the relation
is ..." in the midst of a bunch of "the table is ..." statements, so it
felt out of place. And I made it "the relation is not a table" instead
(with a parenthical comment mentioning a matview), so that all the
others "the table is ..." make sense as followups to it.
Thanks!
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Subversion to GIT: the shortest path to happiness I've ever heard of
(Alexey Klyukin)