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:50:58
Message-ID: E1x40uH-000000041s1-21mT@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
------
master

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

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 18:51:02 pgsql: Restrict REPACK (CONCURRENTLY) to the heap access method.
Previous Message Masahiko Sawada 2026-09-08 18:14:33 pgsql: Fix tablesync failure for partitioned tables on older publishers