REPACK (CONCURRENTLY) fails with wrong error for materialized views

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Subject: REPACK (CONCURRENTLY) fails with wrong error for materialized views
Date: 2026-08-29 15:58:03
Message-ID: CALj2ACXPvy4_LkQ0nHKgbZjAGK9fkDqRYUvXA3hgwxPm_X7Eng@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-Fix-error-message-for-concurrent-repack-on-materi.patch application/octet-stream 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rui Zhao 2026-08-29 16:49:10 Re: Fix GRAPH TABLE label and property error reporting
Previous Message Bharath Rupireddy 2026-08-29 15:34:00 Re: REPACK (CONCURRENTLY) rewrites tables marked with user_catalog_table