| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: REPACK CONCURRENTLY: Don't use deferrable primary keys |
| Date: | 2026-04-27 16:23:49 |
| Message-ID: | E1wHOkO-003596-2l@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
REPACK CONCURRENTLY: Don't use deferrable primary keys
Similarly to logical replication, REPACK CONCURRENTLY needs to ability
to reliably locate a tuple based on an identity. A replica identity
index is okay. Primary keys normally also are, except when they are
deferrable, because a tuple being modified might not yet be indexed,
causing REPACK to fail.
Change the REPACK CONCURRENTLY code to use GetRelationIdentityOrPK(),
similar to what the logical replication code does. (Though we don't yet
support locating tuples based on arbitrary indexes for replica identity
FULL.)
While at it, add a few more test cases for situations that aren't
supported by REPACK, to improve coverage.
Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Antonin Houska <ah(at)cybertec(dot)at>
Reviewed-by: Yuchen Li <liyuchen_xyz(at)163(dot)com>
Discussion: https://postgr.es/m/10DD5E13-B45D-44F1-BE08-C63E00ABCAC0@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/832e220d99afa241d80cd3334eb78439719fe744
Modified Files
--------------
src/backend/commands/repack.c | 15 +++++-----
src/test/regress/expected/cluster.out | 52 +++++++++++++++++++++++++++++++++--
src/test/regress/sql/cluster.sql | 47 +++++++++++++++++++++++++++++--
3 files changed, 102 insertions(+), 12 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-04-28 07:49:55 | pgsql: Fix wrong datum conversion for subretentionactive in CreateSubsc |
| Previous Message | Peter Eisentraut | 2026-04-27 08:46:10 | pgsql: Fix DELETE/UPDATE FOR PORTION OF with rules |