agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: REPACK CONCURRENTLY: Don't use deferrable primary keys
Date: Mon, 27 Apr 2026 16:23:49 +0000
Message-ID: <E1wHOkO-003596-2l@gemulon.postgresql.org> (raw)
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@highgo.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Yuchen Li <liyuchen_xyz@163.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(-)
Message-ID: <E1wHOkO-003596-2l@gemulon.postgresql.org>
Permalink: ../E1wHOkO-003596-2l@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wHOkO-003596-2l@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: REPACK CONCURRENTLY: Don't use deferrable primary keys
In-Reply-To: <E1wHOkO-003596-2l@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox