pgsql: Restrict REPACK (CONCURRENTLY) to the heap access method.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Restrict REPACK (CONCURRENTLY) to the heap access method.
Date: 2026-09-08 18:51:02
Message-ID: E1x40uL-000000041sd-1lFc@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Restrict REPACK (CONCURRENTLY) to the heap access method.

REPACK (CONCURRENTLY) didn't check the table AM of the table being
repacked, so if the table AM doesn't support logical decoding, the
concurrent changes are never decoded and are silently lost from the
rewritten table.

Fix by erroring out for tables that use a non-heap access method.

Reported-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Author: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/apBkixO4xAGFoiT3@nathan
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fe7b60723420c5279824c35efc45630889239a70

Modified Files
--------------
doc/src/sgml/ref/repack.sgml | 6 ++++++
src/backend/commands/repack.c | 14 ++++++++++++++
2 files changed, 20 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-08 19:06:43 pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
Previous Message Masahiko Sawada 2026-09-08 18:50:58 pgsql: Restrict REPACK (CONCURRENTLY) to the heap access method.