Fix error message for concurrent repack on materialized views

Previously, running REPACK (CONCURRENTLY) on a materialized view failed
with a confusing "has no identity index" error.

REPACK (CONCURRENTLY) replays changes decoded from WAL, but a
materialized view produces none, since it cannot be modified by DML and
REFRESH rewrites it through a transient heap that is not logically
decoded.

Fix this by reporting a clear error for materialized views upfront,
alongside the existing checks for system catalogs and TOAST tables, and
document the limitation.

Author: Bharath Rupireddy <[email protected]>
Reviewed-by: Kiran Kaki <[email protected]>
Backpatch-through: 19
Discussion: 
https://postgr.es/m/calj2acxpvy4_lkq0nhkgbzjagk9fkdqryuvxa3hgwxpm_x7...@mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/40d811540a589cbddeb0736966f2541088134163

Modified Files
--------------
contrib/test_decoding/expected/repack.out | 6 ++++++
contrib/test_decoding/sql/repack.sql      | 5 +++++
doc/src/sgml/ref/repack.sgml              | 6 ++++++
src/backend/commands/repack.c             | 8 ++++++++
4 files changed, 25 insertions(+)

Reply via email to