fix_diff.norobots
application/octet-stream
Filename: fix_diff.norobots
Type: application/octet-stream
Part: 0
Message:
Re: Adding REPACK [concurrently]
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 8b5571374d0..53b0fef905c 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -2671,6 +2671,21 @@ setup_logical_decoding(Oid relid)
*/
Assert(!ctx->fast_forward);
+ /* Avoid logical decoding of other relations. */
+ rel = table_open(relid, AccessShareLock);
+ repacked_rel_locator = rel->rd_locator;
+ toastrelid = rel->rd_rel->reltoastrelid;
+ if (OidIsValid(toastrelid))
+ {
+ Relation toastrel;
+
+ /* Avoid logical decoding of other TOAST relations. */
+ toastrel = table_open(toastrelid, AccessShareLock);
+ repacked_rel_toast_locator = toastrel->rd_locator;
+ table_close(toastrel, AccessShareLock);
+ }
+ table_close(rel, AccessShareLock);
+
DecodingContextFindStartpoint(ctx);
/*
@@ -2707,20 +2722,7 @@ setup_logical_decoding(Oid relid)
"REPACK - change",
ALLOCSET_DEFAULT_SIZES);
- /* Avoid logical decoding of other relations. */
- rel = table_open(relid, AccessShareLock);
- repacked_rel_locator = rel->rd_locator;