agora inbox for [email protected]  
help / color / mirror / Atom feed
(no subject)
967+ messages / 2 participants
[nested] [flat]

* (no subject)
@ 2003-02-10 05:24 postgresql <[email protected]>
  0 siblings, 0 replies; 967+ messages in thread

From: postgresql @ 2003-02-10 05:24 UTC (permalink / raw)
  To: pgsql-hackers

Hello to any person who is interested:
Our team are trying hard on the PostgreSQL test,including JDBC,ODBC,SQL.
Could anyone give us some instructions about SQL Conformance?
We've got NIST's SQL Test Suite V6 and tried it.But after checking its some SQL scripts,I found
it was not as good as the publications said.
So  I ask help for any efficiect tool to DBMS SQl test.
Thanks a lot here first.
        postgresql
        [email protected]
          2003-01-20






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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 967+ 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] 967+ messages in thread


end of thread, other threads:[~2026-03-12 15:09 UTC | newest]

Thread overview: 967+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-10 05:24  postgresql <[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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox