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 <[email protected]>
Reviewed-by: Zhijie Hou <[email protected]>
Reviewed-by: Antonin Houska <[email protected]>
Reviewed-by: Yuchen Li <[email protected]>
Discussion: https://postgr.es/m/[email protected]

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(-)

Reply via email to