agora inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 3/9] remove excess parens around ereport
29+ messages / 2 participants
[nested] [flat]

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 29+ messages in thread

* [PATCH v26a 2/2] fixup! instrumentation: Show additional TSC clock source info in pg_test_timing
@ 2026-04-09 15:55  Andres Freund <[email protected]>
  0 siblings, 0 replies; 29+ messages in thread

From: Andres Freund @ 2026-04-09 15:55 UTC (permalink / raw)

---
 src/include/portability/instr_time.h    |  2 ++
 src/common/instr_time.c                 | 18 +++++++++++++++--
 src/port/pg_cpu_x86.c                   |  3 ---
 src/bin/pg_test_timing/pg_test_timing.c | 27 +++++++++++++++++--------
 4 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h
index 4917728afc3..46307fd47a9 100644
--- a/src/include/portability/instr_time.h
+++ b/src/include/portability/instr_time.h
@@ -161,6 +161,7 @@ extern PGDLLIMPORT bool timing_tsc_enabled;
  */
 extern PGDLLIMPORT int32 timing_tsc_frequency_khz;
 
+
 #if PG_INSTR_TSC_CLOCK
 
 extern void pg_initialize_timing_tsc(void);
@@ -178,6 +179,7 @@ extern const TscClockSourceInfo *pg_timing_tsc_clock_source_info(void);
 
 #endif							/* PG_INSTR_TSC_CLOCK */
 
+
 /*
  * Returns the current timing clock source effectively in use, resolving
  * TIMING_CLOCK_SOURCE_AUTO to either TIMING_CLOCK_SOURCE_SYSTEM or
diff --git a/src/common/instr_time.c b/src/common/instr_time.c
index 2523d6a0df6..0db19673490 100644
--- a/src/common/instr_time.c
+++ b/src/common/instr_time.c
@@ -208,9 +208,23 @@ tsc_detect_frequency(void)
 	tsc_info.frequency_khz = 0;
 	tsc_info.frequency_source[0] = '\0';
 
+	strlcat(tsc_info.frequency_source, "x86",
+			sizeof(tsc_info.frequency_source));
+
 	/* We require RDTSCP support and an invariant TSC, bail if not available */
-	if (!x86_feature_available(PG_RDTSCP) || !x86_feature_available(PG_TSC_INVARIANT))
+	if (!x86_feature_available(PG_RDTSCP))
+	{
+		strlcat(tsc_info.frequency_source, ", no rdtscp",
+				sizeof(tsc_info.frequency_source));
 		return;
+	}
+
+	if (!x86_feature_available(PG_TSC_INVARIANT))
+	{
+		strlcat(tsc_info.frequency_source, ", not invariant",
+				sizeof(tsc_info.frequency_source));
+		return;
+	}
 
 	/* Determine speed at which the TSC advances */
 	timing_tsc_frequency_khz = x86_tsc_frequency_khz(tsc_info.frequency_source,
@@ -231,7 +245,7 @@ tsc_detect_frequency(void)
 	timing_tsc_frequency_khz = tsc_info.calibrated_frequency_khz;
 	if (timing_tsc_frequency_khz > 0)
 	{
-		strlcpy(tsc_info.frequency_source, "x86, calibration",
+		strlcat(tsc_info.frequency_source, ", calibration",
 				sizeof(tsc_info.frequency_source));
 		tsc_info.frequency_khz = timing_tsc_frequency_khz;
 	}
diff --git a/src/port/pg_cpu_x86.c b/src/port/pg_cpu_x86.c
index c097807fc7f..56925e9aa51 100644
--- a/src/port/pg_cpu_x86.c
+++ b/src/port/pg_cpu_x86.c
@@ -169,9 +169,6 @@ x86_tsc_frequency_khz(char *source, size_t source_len)
 {
 	unsigned int reg[4] = {0};
 
-	if (source)
-		strlcpy(source, "x86", source_len);
-
 	/*
 	 * If we're inside a virtual machine, try to fetch the TSC frequency from
 	 * the hypervisor, using a hypervisor specific method.
diff --git a/src/bin/pg_test_timing/pg_test_timing.c b/src/bin/pg_test_timing/pg_test_timing.c
index ef5dd90c41f..5cb551fa7b0 100644
--- a/src/bin/pg_test_timing/pg_test_timing.c
+++ b/src/bin/pg_test_timing/pg_test_timing.c
@@ -197,17 +197,28 @@ test_tsc_timing(void)
 		loop_count = test_timing(test_duration, TIMING_CLOCK_SOURCE_TSC, true);
 		output(loop_count);
 		printf("\n");
+	}
 
-		info = pg_timing_tsc_clock_source_info();
-		printf(_("TSC frequency in use: %d kHz\n"), info->frequency_khz);
-		if (info->frequency_source[0] != '\0')
-			printf(_("TSC frequency source: %s\n"), info->frequency_source);
+	/*
+	 * Report TSC information regardless of whether it was usable, makes
+	 * debugging a lot easier.
+	 */
+	info = pg_timing_tsc_clock_source_info();
+	if (info->frequency_source[0] != '\0')
+		printf(_("TSC frequency source: %s\n"), info->frequency_source);
+	printf(_("TSC frequency in use: %d kHz\n"), info->frequency_khz);
 
-		if (info->calibrated_frequency_khz > 0)
-			printf(_("TSC frequency from calibration: %d kHz\n"), info->calibrated_frequency_khz);
-		else
-			printf(_("TSC calibration did not converge\n"));
+	if (info->calibrated_frequency_khz > 0)
+		printf(_("TSC frequency from calibration: %d kHz\n"), info->calibrated_frequency_khz);
+	else
+		printf(_("TSC calibration did not converge\n"));
 
+	/*
+	 * Report whether TSC was usable and, if so, whether it will be used
+	 * automatically.
+	 */
+	if (loop_count > 0)
+	{
 		pg_set_timing_clock_source(TIMING_CLOCK_SOURCE_AUTO);
 		if (pg_current_timing_clock_source() == TIMING_CLOCK_SOURCE_TSC)
 			printf(_("TSC clock source will be used by default, unless timing_clock_source is set to 'system'.\n"));
-- 
2.53.0.1.gb2826b52eb


--5ynaw2hkmtmijn2o--





^ permalink  raw  reply  [nested|flat] 29+ messages in thread


end of thread, other threads:[~2026-04-09 15:55 UTC | newest]

Thread overview: 29+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-04-09 15:55 [PATCH v26a 2/2] fixup! instrumentation: Show additional TSC clock source info in pg_test_timing Andres Freund <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox